summaryrefslogtreecommitdiffstats
path: root/test/test_travis_conditions.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
commit7b31d4f4901cdb89a79f2f7de4a6b8bb637b523b (patch)
treefdeb0b5ff80273f95ce61607fc3613dff0b9a235 /test/test_travis_conditions.sh
parentAdding upstream version 2.4.38. (diff)
downloadapache2-upstream.tar.xz
apache2-upstream.zip
Adding upstream version 2.4.59.upstream/2.4.59upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_travis_conditions.sh')
-rwxr-xr-xtest/test_travis_conditions.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/test_travis_conditions.sh b/test/test_travis_conditions.sh
new file mode 100755
index 0000000..82794eb
--- /dev/null
+++ b/test/test_travis_conditions.sh
@@ -0,0 +1,42 @@
+#!/bin/sh -e
+# Script to test whether travis conditions match correctly.
+# "gem install travis-conditions". Tests .travis.yml in the cwd.
+
+cond_24x="`sed -n '/&condition_24x_only/{s/.*condition_24x_only//;p;q;}' .travis.yml`"
+cond_not_24x="`sed -n '/&condition_not_24x/{s/.*condition_not_24x//;p;q;}' .travis.yml`"
+
+echo Condition 2.4.x: ${cond_24x}
+echo Condition not 2.4.x: ${cond_not_24x}
+
+function testit()
+{
+ local data=$1
+ local expect=$2
+
+ is_24x=`travis-conditions eval "$cond_24x" --data "${data}"`
+ not_24x=`travis-conditions eval "$cond_not_24x" --data "${data}"`
+
+ if [ $is_24x = $not_24x ]; then
+ echo FAIL: Tests as both 2.4.x and not 2.4.x for "$data"
+ return 1
+ elif [ $expect = 2.4.x -a $is_24x = true ]; then
+ echo PASS
+ elif [ $expect = trunk ]; then
+ echo PASS
+ else
+ echo FAIL for "$data"
+ return 1
+ fi
+ return 0
+}
+
+testit '{"tag": "2.4.49"}' 2.4.x
+testit '{"tag": "2.5.59"}' trunk
+testit '{"branch": "2.4.x"}' 2.4.x
+testit '{"branch": "candidate-2.4.49"}' 2.4.x
+testit '{"branch": "2.4.55-candidate"}' 2.4.x
+testit '{"branch": "2.4-backport-branch"}' 2.4.x
+testit '{"branch": "2.4.x-something"}' 2.4.x
+testit '{"branch": "2.5.0"}' trunk
+testit '{"branch": "2.5.x"}' trunk
+testit '{"branch": "trunk"}' trunk