2 ################################################################################
6 # Wrapper around curl's runtests.pl that sets a couple of options
7 # so Privoxy is being used.
9 # Copyright (c) 2013-2021 Fabian Keil <fk@fabiankeil.de>
11 # Permission to use, copy, modify, and distribute this software for any
12 # purpose with or without fee is hereby granted, provided that the above
13 # copyright notice and this permission notice appear in all copies.
15 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
18 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 ################################################################################
24 curl_setup_is_sane() {
25 local curl_source_directory="${1}"
26 local curl_binary="${curl_source_directory}/src/curl"
27 local runtests_pl="${curl_source_directory}/tests/runtests.pl"
29 if [ ! -d "${curl_source_directory}" ]; then
30 echo "Missing curl source directory at ${curl_source_directory}"
33 if [ ! -f "${curl_binary}" ]; then
34 echo "Missing curl binary at ${curl_binary}. Did you compile curl?"
37 if [ ! -f "${runtests_pl}" ]; then
38 echo "Did not find runtests.pl at ${runtests_pl}"
47 a_flag proxy_args exclude_file_args testdir_args \
48 privoxy_lib privoxy_ip privoxy_source_directory curl_source_directory \
49 keyword directory_name test_dir
51 directory_name="$(dirname "$0")"
52 test_dir="$(realpath "${directory_name}")"
53 privoxy_source_directory="$(realpath "${test_dir}"/../..)"
54 privoxy_lib="${privoxy_source_directory}/tests/cts/privoxy-runtests.pm"
55 curl_source_directory="$(realpath "${privoxy_source_directory}"/../curl)"
57 curl_setup_is_sane "${curl_source_directory}" || exit 1
59 # Defaults that can be changed through arguments
63 proxy_args="-P http://${privoxy_ip}:${privoxy_port}/ -o HOSTIP=${privoxy_ip}"
64 exclude_file_args="-E ${privoxy_source_directory}/tests/cts/curl-test-manifest-for-privoxy"
65 testdir_args="-o TESTDIR=${privoxy_source_directory}/tests/cts/data"
88 proxy_args="-P http://${privoxy_ip}:${privoxy_port}/ -o HOSTIP=${privoxy_ip}"
91 echo "Not setting TESTDIR"
97 echo "Overwriting default TESTDIR with $1"
98 testdir_args="-o TESTDIR=$1"
105 proxy_args="-P http://${privoxy_ip}:${privoxy_port}/ -o HOSTIP=${privoxy_ip}"
108 # "Obviously" -P means not setting -P
109 echo "Not setting '$proxy_args'"
120 cd "${curl_source_directory}/tests" || exit 1
121 ./runtests.pl -L "${privoxy_lib}" $proxy_args $exclude_file_args $testdir_args $a_flag -n $keyword !skip $extra_args
125 runtests_wrapper "$@"