]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1892841, r1892845 from trunk:
authorJoe Orton <jorton@apache.org>
Fri, 3 Sep 2021 08:33:22 +0000 (08:33 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 3 Sep 2021 08:33:22 +0000 (08:33 +0000)
Adjust Travis conditions for candidate-2.4.x tags.

Second attempt at updating the Travis conditions to work properly
for candidate-2.4.x branches, and add a mini test script for the
conditions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892846 13f79535-47bb-0310-9956-ffa450edef68

.travis.yml
test/test_travis_conditions.sh [new file with mode: 0755]

index fac863ef509a1df895869b6af26d7e29f707891f..96fefc645c9ff2b2b9031f82ab8b9f6956f70c4f 100644 (file)
@@ -37,8 +37,8 @@ env:
 # definitions to either:
 #  condition_24x_only => run the job only for 2.4.x
 #  condition_not_24x  => run the job everywhere EXCEPT 2.4.x
-_cond1: &condition_24x_only (branch is present AND branch = 2.4.x) OR (tag is present AND tag ~= /^2.4/)
-_cond2: &condition_not_24x (branch is not present OR branch != 2.4.x) AND (tag is not present OR tag !~ /^2.4/)
+_cond1: &condition_24x_only (branch is present AND (branch = 2.4.x OR branch ~= /^candidate-2.4/)) OR (tag is present AND tag ~= /^2.4/)
+_cond2: &condition_not_24x (branch is not present OR (branch != 2.4.x AND branch !~ /^candidate-2.4/)) AND (tag is not present OR tag !~ /^2.4/)
 
 jobs:
   include:
diff --git a/test/test_travis_conditions.sh b/test/test_travis_conditions.sh
new file mode 100755 (executable)
index 0000000..32f663a
--- /dev/null
@@ -0,0 +1,39 @@
+#!/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.5.0"}' trunk
+testit '{"branch": "2.5.x"}' trunk
+testit '{"branch": "trunk"}' trunk