File: cachedir

package info (click to toggle)
weborf 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,152 kB
  • sloc: sh: 5,272; ansic: 3,505; python: 762; makefile: 119; xml: 44
file content (38 lines) | stat: -rwxr-xr-x 828 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
. testsuite/functions.sh

PORT=12352

# Test that it fails with a non existing cache directory
if "$BINNAME" -db site1 -p $PORT --cache "/tmp/fakecachedir" --index nonexisting; then
    exit 1
fi

CACHE_DIR=$(mktemp -d)
"$BINNAME" -b site1 -p $PORT --cache $CACHE_DIR --index nonexisting &
WEBORF_PID=$(jobs -p)

function cleanup () {
    kill -9 $WEBORF_PID
    ls "$CACHE_DIR"
    rm -rf "$CACHE_DIR"
    rm -f site1/cachedir.test
}
trap cleanup EXIT

curl -s http://localhost:$PORT/

[[ "$(ls $CACHE_DIR | wc -l)" = 1 ]]
curl -s http://localhost:$PORT/ | diff - $CACHE_DIR/*

touch site1/cachedir.test
sleep 1.1
curl -s http://localhost:$PORT/ | grep cachedir.test

rm site1/cachedir.test
sleep 1.1

if curl -s http://localhost:$PORT/ | grep cachedir.test; then
    exit 1
fi
[[ "$(ls $CACHE_DIR | wc -l)" = 3 ]]