blob: 3ab6ae4e5b1c396d4ad6935fd838824643e62547 [file] [log] [blame]
Maximilian Maderfc0cceb2021-06-06 00:50:22 +02001varnishtest "Tests the -cc argument"
2
Maximilian Maderfc0cceb2021-06-06 00:50:22 +02003feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
4
5shell {
Willy Tarreaub333db32021-07-17 10:54:46 +02006 set -e
Maximilian Maderfc0cceb2021-06-06 00:50:22 +02007 $HAPROXY_PROGRAM -cc "version_atleast(2.4)"
8 ! $HAPROXY_PROGRAM -cc "version_atleast(1024)"
9
10 $HAPROXY_PROGRAM -cc "streq(foo,'foo')"
11 $HAPROXY_PROGRAM -cc "streq(\"foo bar\",'foo bar')"
12 ! $HAPROXY_PROGRAM -cc "streq(foo,bar)"
Willy Tarreauf2e44d42021-07-17 10:43:33 +020013
14 if $HAPROXY_PROGRAM -cc "version_atleast(2.5-dev2)"; then
15 export TESTVAR=1
16 $HAPROXY_PROGRAM -cc 'defined(TESTVAR) && streq("$TESTVAR","1")'
17 $HAPROXY_PROGRAM -cc 'feature(OPENSSL) || !feature(OPENSSL)'
18 $HAPROXY_PROGRAM -cc '1&&!0&&!((streq(a,b)||!streq(a,a)&&1)||strneq(a,a))'
19 $HAPROXY_PROGRAM -cc '1 &&! 0&& !((streq(a,b)||!streq(a,a)&&1)||strneq(a,a))'
20 $HAPROXY_PROGRAM -cc '1 && !0 && !((streq(a,b) || !streq(a,a) && 1) || strneq(a,a))'
21 ! $HAPROXY_PROGRAM -cc '1 && !0 && !((streq(a,b) || !streq(a,a) && 1) || strneq(a,b))'
22 ! $HAPROXY_PROGRAM -cc '1 && !0 && !((streq(a,a) || !streq(a,a) && 1) || strneq(a,a))'
23 # empty string is always false
24 ! $HAPROXY_PROGRAM -cc ''
25 # non-zero is true
26 $HAPROXY_PROGRAM -cc '-1000 && 200'
27 # check for various parsing errors (extra/missing chars)
28 ! $HAPROXY_PROGRAM -cc '200rrr'
29 ! $HAPROXY_PROGRAM -cc '!(0))'
30 ! $HAPROXY_PROGRAM -cc 'streq(a,"a)'
31 fi
Maximilian Maderfc0cceb2021-06-06 00:50:22 +020032} -run