]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #12510 from keszybz/test-directives
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 May 2019 23:35:10 +0000 (08:35 +0900)
committerGitHub <noreply@github.com>
Mon, 20 May 2019 23:35:10 +0000 (08:35 +0900)
test: run check-directives.sh as part of the test suite

meson.build
tools/check-directives.sh
travis-ci/managers/debian.sh
travis-ci/managers/fedora.sh
travis-ci/managers/xenial.sh
travis-ci/requirements.txt

index c7c0c3ffd06f5d14fdee7f8b341c504df4f9f519..cd2fbd5796d960e2a819c70c1a53d3549cee440f 100644 (file)
@@ -2928,6 +2928,16 @@ endforeach
 
 ############################################################
 
+check_directives_sh = find_program('tools/check-directives.sh')
+
+if want_tests != 'false'
+        test('check-directives',
+             check_directives_sh,
+             args : project_source_root)
+endif
+
+############################################################
+
 # Enable tests for all supported sanitizers
 foreach tuple : sanitizers
         sanitizer = tuple[0]
index 46f770222f54d4312c2340a779c1a650fa569a18..a90fb604ae0999d6ba3a7907a7c6a50eac7d5c15 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 set -e
 
+which perl &>/dev/null || exit 77
+
 function generate_directives() {
     perl -aF'/[\s,]+/' -ne '
         if (my ($s, $d) = ($F[0] =~ /^([^\s\.]+)\.([^\s\.]+)$/)) { $d{$s}{"$d="} = 1; }
@@ -11,22 +13,22 @@ function generate_directives() {
 
 ret=0
 if ! diff \
-     <(generate_directives src/network/networkd-network-gperf.gperf | sort) \
-     <(cat test/fuzz/fuzz-network-parser/directives.network | sort); then
+     <(generate_directives "$1"/src/network/networkd-network-gperf.gperf | sort) \
+     <(cat "$1"/test/fuzz/fuzz-network-parser/directives.network | sort); then
     echo "Looks like test/fuzz/fuzz-network-parser/directives.network hasn't been updated"
     ret=1
 fi
 
 if ! diff \
-     <(generate_directives src/network/netdev/netdev-gperf.gperf | sort) \
-     <(cat test/fuzz/fuzz-netdev-parser/directives.netdev | sort); then
+     <(generate_directives "$1"/src/network/netdev/netdev-gperf.gperf | sort) \
+     <(cat "$1"/test/fuzz/fuzz-netdev-parser/directives.netdev | sort); then
     echo "Looks like test/fuzz/fuzz-netdev-parser/directives.netdev hasn't been updated"
     ret=1
 fi
 
 if ! diff \
-     <(generate_directives src/udev/net/link-config-gperf.gperf | sort) \
-     <(cat test/fuzz/fuzz-link-parser/directives.link | sort) ; then
+     <(generate_directives "$1"/src/udev/net/link-config-gperf.gperf | sort) \
+     <(cat "$1"/test/fuzz/fuzz-link-parser/directives.link | sort) ; then
     echo "Looks like test/fuzz/fuzz-link-parser/directives.link hasn't been updated"
     ret=1
 fi
index df26b16e2c5b239fd3a4daa5b41a1dfaf24ff626..dd9b816c986928a872e36b1bc66f892c13977eec 100755 (executable)
@@ -15,7 +15,10 @@ CONT_NAME="${CONT_NAME:-debian-$DEBIAN_RELEASE-$RANDOM}"
 DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
 DOCKER_RUN="${DOCKER_RUN:-docker run}"
 REPO_ROOT="${REPO_ROOT:-$PWD}"
-ADDITIONAL_DEPS=(python3-libevdev python3-pyparsing clang)
+ADDITIONAL_DEPS=(python3-libevdev
+                 python3-pyparsing
+                 clang
+                 perl)
 
 function info() {
     echo -e "\033[33;1m$1\033[0m"
@@ -47,7 +50,6 @@ for phase in "${PHASES[@]}"; do
             docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true -Dman=true build
             $DOCKER_EXEC ninja -v -C build
             docker exec -e "TRAVIS=$TRAVIS" -it $CONT_NAME ninja -C build test
-            $DOCKER_EXEC tools/check-directives.sh
             ;;
         RUN_ASAN|RUN_CLANG_ASAN)
             if [[ "$phase" = "RUN_CLANG_ASAN" ]]; then
index f821ee264084691ab969735af08072934badd717..38cb3d3158454a604890fd07bab79a68a0108486 100755 (executable)
@@ -15,7 +15,15 @@ CONT_NAME="${CONT_NAME:-fedora-$FEDORA_RELEASE-$RANDOM}"
 DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
 DOCKER_RUN="${DOCKER_RUN:-docker run}"
 REPO_ROOT="${REPO_ROOT:-$PWD}"
-ADDITIONAL_DEPS=(dnf-plugins-core python2 iputils hostname libasan python3-pyparsing python3-evdev libubsan clang llvm)
+ADDITIONAL_DEPS=(dnf-plugins-core
+                 python2 iputils
+                 hostname libasan
+                 python3-pyparsing
+                 python3-evdev
+                 libubsan
+                 clang
+                 llvm
+                 perl)
 
 function info() {
     echo -e "\033[33;1m$1\033[0m"
@@ -50,7 +58,6 @@ for phase in "${PHASES[@]}"; do
             $DOCKER_EXEC meson --werror -Dtests=unsafe -Dslow-tests=true build
             $DOCKER_EXEC ninja -v -C build
             $DOCKER_EXEC ninja -C build test
-            $DOCKER_EXEC tools/check-directives.sh
             ;;
         RUN_CLANG)
             docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dman=true build
index 8995a51f84e4ceb7d3048e971261a94d002febaf..475a1510aa20ef3bc0faa3769e54706bd78f7316 100755 (executable)
@@ -2,14 +2,48 @@
 set -e
 set -x
 
+PACKAGES=(cryptsetup-bin
+          gettext
+          iptables-dev
+          iputils-ping
+          isc-dhcp-client
+          itstool
+          kbd
+          libblkid-dev
+          libcap-dev
+          libcurl4-gnutls-dev
+          libgpg-error-dev
+          liblz4-dev
+          liblzma-dev
+          libmicrohttpd-dev
+          libmount-dev
+          libmount-dev
+          libqrencode-dev
+          libxkbcommon-dev
+          linux-image-virtual
+          mount
+          net-tools
+          ninja-build
+          perl
+          python-lxml
+          python3-evdev
+          python3-lxml
+          python3-pip
+          python3-pyparsing
+          python3-setuptools
+          qemu-system-x86
+          strace
+          unifont
+          util-linux)
+
 bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list"
+
 apt-get update
 apt-get build-dep systemd -y
-apt-get install -y util-linux libmount-dev libblkid-dev liblzma-dev libqrencode-dev libmicrohttpd-dev iptables-dev liblz4-dev libcurl4-gnutls-dev unifont itstool kbd cryptsetup-bin net-tools isc-dhcp-client iputils-ping strace qemu-system-x86 linux-image-virtual mount libgpg-error-dev libxkbcommon-dev python-lxml python3-lxml python3-pip libcap-dev
-apt-get install -y gettext python3-evdev python3-pyparsing libmount-dev python3-setuptools ninja-build
+apt-get install -y "${PACKAGES[@]}"
 pip3 install meson
 
-cd ${REPO_ROOT:-$(pwd)}
+cd ${REPO_ROOT:-$PWD}
 
 sed -i 's/2\.30/2.27/' meson.build
 
index 9928e3fc87ef02790f8dcd34c0d65ef99477420f..5ef30d5d3f7ddf13b75b74842d3209a96b4998a5 100644 (file)
@@ -1,4 +1,5 @@
 dnf-plugins-core
 meson
 ninja-build
+perl
 python