/[volute]/trunk/projects/vocabularies/check-uris.sh.in
ViewVC logotype

Contents of /trunk/projects/vocabularies/check-uris.sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2120 - (show annotations)
Fri Apr 19 17:22:11 2013 UTC (8 years, 5 months ago) by norman.x.gray
File size: 2806 byte(s)
Add check-uris-rec-1.19.sh to help website maintainer check relevant configuration
1 #! /bin/sh -
2
3 BASEURI=@BASEURI@
4 DISTNAME=@DISTNAME@
5
6 check_uri () {
7 uri=$1
8 header=$2
9 if test -n "$3"; then accept="-H $3"; else accept=""; fi
10 if test -z "$header"; then
11 curl --head $accept $uri 2>/dev/null | sed -n "1s/HTTP[^ ]* *\([0-9]*\).*/status=\1/p"
12 else
13 curl --head $accept $uri 2>/dev/null | sed -n "1s/HTTP[^ ]* *\([0-9]*\).*/status=\1/p
14 s/^$header: *\([^[:space:]]*\).*/$header=\1/p"
15 fi
16 }
17
18 check_status () {
19 # $1 = URL to check
20 # $2 = expected status
21 eval `check_uri $1`
22 if test "$status" = $2; then
23 echo "OK: $1"
24 else
25 echo "Failed: $1"
26 echo " produced status=$status"
27 echo " expected status=$2"
28 allok=false
29 fi
30 }
31
32 check_status_and_location () {
33 # $1 = URL to check
34 # $2 = expected status
35 # $3 = expected location
36 # $4 = extra header for curl
37 eval `check_uri $1 Location $4`
38 if test "$status" = $2 -a "$Location" = $3; then
39 echo "OK: $1 [$4]"
40 else
41 echo "Failed: $1 [$4]"
42 echo " produced status=$status, Location=$Location"
43 echo " expected status=$2, Location=$3"
44 allok=false
45 fi
46 }
47
48
49 allok=:
50
51 # Check redirections (just do it for the AAkeys, since the
52 # others should be identical)
53
54 check_status_and_location $BASEURI/AAkeys \
55 303 \
56 $BASEURI/$DISTNAME/AAkeys/AAkeys.html
57 check_status_and_location $BASEURI/AAkeys \
58 303 \
59 $BASEURI/$DISTNAME/AAkeys/AAkeys.html \
60 accept:text/html
61 check_status $BASEURI/$DISTNAME/AAkeys/AAkeys.html 200
62
63 check_status_and_location $BASEURI/AAkeys \
64 303 \
65 $BASEURI/$DISTNAME/AAkeys/AAkeys.ttl \
66 accept:text/rdf+n3
67 check_status_and_location $BASEURI/AAkeys \
68 303 \
69 $BASEURI/$DISTNAME/AAkeys/AAkeys.ttl \
70 accept:text/turtle
71 check_status $BASEURI/$DISTNAME/AAkeys/AAkeys.ttl 200
72
73
74 check_status_and_location $BASEURI/AAkeys \
75 303 \
76 $BASEURI/$DISTNAME/AAkeys/AAkeys.rdf \
77 accept:application/rdf+xml
78 check_status $BASEURI/$DISTNAME/AAkeys/AAkeys.rdf 200
79
80
81 # Mappings file (basically the same as the vocabularies files)
82 check_status_and_location $BASEURI/AAkeys2AVM \
83 303 \
84 $BASEURI/$DISTNAME/AAkeys2AVM/AAkeys2AVM.html
85 check_status_and_location $BASEURI/AAkeys2AVM \
86 303 \
87 $BASEURI/$DISTNAME/AAkeys2AVM/AAkeys2AVM.rdf \
88 accept:application/rdf+xml
89 check_status $BASEURI/$DISTNAME/AAkeys2AVM/AAkeys2AVM.rdf 200
90 check_status_and_location $BASEURI/AAkeys2AVM \
91 303 \
92 $BASEURI/$DISTNAME/AAkeys2AVM/AAkeys2AVM.ttl \
93 accept:text/turtle
94 check_status $BASEURI/$DISTNAME/AAkeys2AVM/AAkeys2AVM.ttl 200
95
96 # check location of tarball
97
98 check_status $BASEURI/$DISTNAME.tar.gz 200
99
100 # How'd we get on?
101
102 if $allok; then
103 echo "All tests passed!"
104 exit 0
105 else
106 echo "Some tests failed. Boo!"
107 exit 1
108 fi

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26