1#!/bin/sh
2#
3# $Id: check_server.sh,v 1.9 2006/10/15 10:08:51 airborne Exp $
4
5. ./settings.sh
6
7# This script implements a set of tests to check whether the CDDB
8# server access functionality is working correctly.  It tests all
9# three protocols: CDDBP, HTTP and HTTP via a proxy.  We set the local
10# cache dir to the directory with the test data to make sure we do not
11# read the requested entries from the cache.
12
13# Check whether we have proxy settings
14if test -z "$http_proxy"; then
15    NO_PROXY=1
16    NO_PROXY_REASON='$http_proxy not defined'
17else
18    NO_PROXY=0
19fi
20
21#
22# Query disc with single match
23#
24QUERY_DATA='2259 8 155 25947 47357 66630 91222 110355 124755 148317'
25
26start_test 'CDDBP disc query (single match)'
27cddb_query -c off -D $CDDB_CACHE -P cddbp query $QUERY_DATA
28check_query $?
29
30start_test 'HTTP  disc query (single match)'
31cddb_query -c off -D $CDDB_CACHE -P http  query $QUERY_DATA
32check_query $?
33
34start_test 'PROXY disc query (single match)'
35if test $NO_PROXY -eq 1; then
36    skip $NO_PROXY_REASON
37else
38    cddb_query -c off -D $CDDB_CACHE -P proxy query $QUERY_DATA
39    check_query $?
40fi
41
42#
43# Query disc with multiple matches
44#
45QUERY_DATA='3822 11 150 28690 51102 75910 102682 121522 149040 175772 204387 231145 268065'
46
47start_test 'CDDBP disc query (multiple matches)'
48cddb_query -c off -D $CDDB_CACHE -P cddbp query $QUERY_DATA
49check_query $?
50
51start_test 'HTTP  disc query (multiple matches)'
52cddb_query -c off -D $CDDB_CACHE -P http  query $QUERY_DATA
53check_query $?
54
55start_test 'PROXY disc query (multiple matches)'
56if test $NO_PROXY -eq 1; then
57    skip $NO_PROXY_REASON
58else
59    cddb_query -c off -D $CDDB_CACHE -P proxy query $QUERY_DATA
60    check_query $?
61fi
62
63#
64# Search string (multiple matches)
65#
66SEARCH_DATA='mezzanine'
67
68start_test 'HTTP  text search (multiple matches, freedb.org)'
69skip "no longer suported on freedb.org"
70#cddb_query search $SEARCH_DATA
71#check_query $?
72
73start_test 'HTTP  album search (multiple matches, freedb2.org)'
74cddb_query -s freedb2.org -P http album '' $SEARCH_DATA
75check_query $?
76
77#
78# Read disc data from server
79#
80DISCID='920ef00b'
81
82start_test 'CDDBP disc read '${DISCID}
83cddb_query -c off -D $CDDB_CACHE -P cddbp read misc $DISCID
84check_read $? $DISCID
85
86start_test 'HTTP  disc read '${DISCID}
87cddb_query -c off -D $CDDB_CACHE -P http  read misc $DISCID
88check_read $? $DISCID
89
90start_test 'PROXY disc read '${DISCID}
91if test $NO_PROXY -eq 1; then
92    skip $NO_PROXY_REASON
93else
94    cddb_query -c off -D $CDDB_CACHE -P proxy read misc $DISCID
95    check_read $? $DISCID
96fi
97
98#
99# Print results and exit accordingly
100#
101finalize
102