Maximilian Mader | fc0cceb | 2021-06-06 00:50:22 +0200 | [diff] [blame] | 1 | varnishtest "Tests the -cc argument" |
| 2 | |
Maximilian Mader | fc0cceb | 2021-06-06 00:50:22 +0200 | [diff] [blame] | 3 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
| 4 | |
| 5 | shell { |
Willy Tarreau | b333db3 | 2021-07-17 10:54:46 +0200 | [diff] [blame] | 6 | set -e |
Maximilian Mader | fc0cceb | 2021-06-06 00:50:22 +0200 | [diff] [blame] | 7 | $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 Tarreau | f2e44d4 | 2021-07-17 10:43:33 +0200 | [diff] [blame] | 13 | |
| 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 Mader | fc0cceb | 2021-06-06 00:50:22 +0200 | [diff] [blame] | 32 | } -run |