File: check_server.sh

package info (click to toggle)
libcddb 1.3.2-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 2,276 kB
  • sloc: sh: 10,946; ansic: 4,721; makefile: 44
file content (101 lines) | stat: -rwxr-xr-x 2,580 bytes parent folder | download | duplicates (5)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
#
# $Id: check_server.sh,v 1.9 2006/10/15 10:08:51 airborne Exp $

. ./settings.sh

# This script implements a set of tests to check whether the CDDB
# server access functionality is working correctly.  It tests all
# three protocols: CDDBP, HTTP and HTTP via a proxy.  We set the local
# cache dir to the directory with the test data to make sure we do not
# read the requested entries from the cache.

# Check whether we have proxy settings
if test -z "$http_proxy"; then
    NO_PROXY=1
    NO_PROXY_REASON='$http_proxy not defined'
else 
    NO_PROXY=0
fi

#
# Query disc with single match
#
QUERY_DATA='2259 8 155 25947 47357 66630 91222 110355 124755 148317'

start_test 'CDDBP disc query (single match)'
cddb_query -c off -D $CDDB_CACHE -P cddbp query $QUERY_DATA
check_query $?

start_test 'HTTP  disc query (single match)'
cddb_query -c off -D $CDDB_CACHE -P http  query $QUERY_DATA
check_query $?

start_test 'PROXY disc query (single match)'
if test $NO_PROXY -eq 1; then
    skip $NO_PROXY_REASON
else
    cddb_query -c off -D $CDDB_CACHE -P proxy query $QUERY_DATA
    check_query $?
fi

#
# Query disc with multiple matches
#
QUERY_DATA='3822 11 150 28690 51102 75910 102682 121522 149040 175772 204387 231145 268065'

start_test 'CDDBP disc query (multiple matches)'
cddb_query -c off -D $CDDB_CACHE -P cddbp query $QUERY_DATA
check_query $?

start_test 'HTTP  disc query (multiple matches)'
cddb_query -c off -D $CDDB_CACHE -P http  query $QUERY_DATA
check_query $?

start_test 'PROXY disc query (multiple matches)'
if test $NO_PROXY -eq 1; then
    skip $NO_PROXY_REASON
else
    cddb_query -c off -D $CDDB_CACHE -P proxy query $QUERY_DATA
    check_query $?
fi

#
# Search string (multiple matches)
#
SEARCH_DATA='mezzanine'

start_test 'HTTP  text search (multiple matches, freedb.org)'
skip "no longer suported on freedb.org"
#cddb_query search $SEARCH_DATA
#check_query $?

start_test 'HTTP  album search (multiple matches, freedb2.org)'
cddb_query -s freedb2.org -P http album '' $SEARCH_DATA
check_query $?

#
# Read disc data from server
#
DISCID='920ef00b'

start_test 'CDDBP disc read '${DISCID}
cddb_query -c off -D $CDDB_CACHE -P cddbp read misc $DISCID
check_read $? $DISCID

start_test 'HTTP  disc read '${DISCID}
cddb_query -c off -D $CDDB_CACHE -P http  read misc $DISCID
check_read $? $DISCID

start_test 'PROXY disc read '${DISCID}
if test $NO_PROXY -eq 1; then
    skip $NO_PROXY_REASON
else
    cddb_query -c off -D $CDDB_CACHE -P proxy read misc $DISCID
    check_read $? $DISCID
fi

#
# Print results and exit accordingly
#
finalize