From 0e100ff13d4df3208d63b74ab4812b7e2a0c17bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oto=20=C5=A0=C5=A5=C3=A1va?= <oto.stava@nic.cz> Date: Fri, 2 Aug 2024 17:07:25 +0200 Subject: [PATCH 1/3] treewide: use /usr/bin/env for shebangs This makes the scripts compatible with setups where they use commands from somewhere other than `/bin` or `/usr/bin`, a prominent OS doing this being NixOS. But also, anyone may wish to just override things for their particular setup. Especially with Python, this enables the proper use of virtualenvs. --- ci/compare-rplint.sh | 2 +- ci/compare-tests.sh | 2 +- ci/junit-compare.py | 2 +- ci/pylint-run.sh | 2 +- ci/raw_id.py | 2 +- ci/raw_id_check.sh | 4 ++-- ci/runlocally.sh | 2 +- getdns_run.sh | 2 +- knotd_master_run.sh | 2 +- knotd_slave_run.sh | 2 +- kresd_run.sh | 2 +- named_run.sh | 2 +- pdns_run.sh | 2 +- pydnstest/augwrap.py | 2 +- rplint.sh | 2 +- run.sh | 2 +- tools/divide_tests.sh | 8 ++++---- unbound_run.sh | 2 +- 18 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ci/compare-rplint.sh b/ci/compare-rplint.sh index 0146dc9..cb4dad0 100755 --- a/ci/compare-rplint.sh +++ b/ci/compare-rplint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o nounset -o xtrace -o errexit source "$(dirname "$(readlink -f "$0")")/common.sh" diff --git a/ci/compare-tests.sh b/ci/compare-tests.sh index 63d8c67..460f7f1 100755 --- a/ci/compare-tests.sh +++ b/ci/compare-tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o nounset -o xtrace -o errexit source "$(dirname "$0")/common.sh" TESTRUNNER="$1" diff --git a/ci/junit-compare.py b/ci/junit-compare.py index 23409bb..c939449 100755 --- a/ci/junit-compare.py +++ b/ci/junit-compare.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import sys diff --git a/ci/pylint-run.sh b/ci/pylint-run.sh index 107c674..788a4f5 100755 --- a/ci/pylint-run.sh +++ b/ci/pylint-run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o nounset -o errexit source "$(dirname "$0")/common.sh" diff --git a/ci/raw_id.py b/ci/raw_id.py index cc4fe8e..19c4237 100755 --- a/ci/raw_id.py +++ b/ci/raw_id.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import sys import dns.message diff --git a/ci/raw_id_check.sh b/ci/raw_id_check.sh index 336b37b..94c58f1 100755 --- a/ci/raw_id_check.sh +++ b/ci/raw_id_check.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash make depend cat env.sh source env.sh python3 -m pydnstest.testserver --scenario $(pwd)/tests/deckard_raw_id.rpl & sleep 1 -python3 -m ci.raw_id \ No newline at end of file +python3 -m ci.raw_id diff --git a/ci/runlocally.sh b/ci/runlocally.sh index 25bf0c9..5829ca2 100755 --- a/ci/runlocally.sh +++ b/ci/runlocally.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o nounset -o errexit CIDIR="$(dirname "$0")" ORIGNAME="$(git symbolic-ref -q --short HEAD || git describe --all --always HEAD)" diff --git a/getdns_run.sh b/getdns_run.sh index 2dc7313..707dd14 100755 --- a/getdns_run.sh +++ b/getdns_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset # Below a summary of tests that failed including a reason for the failure. diff --git a/knotd_master_run.sh b/knotd_master_run.sh index 9a61f3c..3d7cb07 100755 --- a/knotd_master_run.sh +++ b/knotd_master_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset echo 'INFO: Tests require Knot compiled with ./configure --enable-recvmmsg=no' diff --git a/knotd_slave_run.sh b/knotd_slave_run.sh index 239cef1..1b7c118 100755 --- a/knotd_slave_run.sh +++ b/knotd_slave_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset echo 'INFO: Tests require Knot compiled with ./configure --enable-recvmmsg=no' diff --git a/kresd_run.sh b/kresd_run.sh index 5fd93e1..b65778a 100755 --- a/kresd_run.sh +++ b/kresd_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset RUNDIR="$(dirname "$0")" diff --git a/named_run.sh b/named_run.sh index d8a044b..a7cf2ed 100755 --- a/named_run.sh +++ b/named_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset named -V | grep --quiet -- '--without-jemalloc' || echo 'WARNING: Make sure BIND is compiled without jemalloc library; for 9.17+ use ./configure --without-jemalloc' MINOR="$(named -v | cut -d . -f 2)" diff --git a/pdns_run.sh b/pdns_run.sh index bb1900e..60094f0 100755 --- a/pdns_run.sh +++ b/pdns_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset RUNDIR="$(dirname "$0")" diff --git a/pydnstest/augwrap.py b/pydnstest/augwrap.py index a0ec190..8f89e0b 100644 --- a/pydnstest/augwrap.py +++ b/pydnstest/augwrap.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # Copyright (C) 2017 diff --git a/rplint.sh b/rplint.sh index ccdc435..9e569f3 100755 --- a/rplint.sh +++ b/rplint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -x set -o errexit -o nounset MAKEDIR="$(dirname "$0")" diff --git a/run.sh b/run.sh index 911fce5..2ac4c84 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash MAKEDIR="$(dirname "$0")" # Currently there no tests requiring faking monotonic time in this repository (there are some elsewhere) diff --git a/tools/divide_tests.sh b/tools/divide_tests.sh index 1856610..31b5ed2 100644 --- a/tools/divide_tests.sh +++ b/tools/divide_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Sorts .rpl tests into several categories. # Takes a diretory with the tests as an argument and moves the test to its subdirectories. @@ -48,20 +48,20 @@ mkdir -p "$DEST/sorted_tests/invaliddsa" for TEST in "$DEST/sorted_tests/"*.rpl do if ! python3 invalid_dsa.py "$TEST" >/dev/null 2>/dev/null - then + then echo -e '\t' $(basename "$TEST") mv "$TEST" "$DEST/sorted_tests/invaliddsa" fi done -# Working in selected script +# Working in selected script echo Working in $SCRIPT: mkdir -p "$DEST/sorted_tests/working" for TEST in "$DEST/sorted_tests/"*.rpl do if TESTS="$(readlink -m $TEST)" $SCRIPT >/dev/null 2>/dev/null - then + then echo -e '\t' $(basename "$TEST") mv "$TEST" "$DEST/sorted_tests/working" fi diff --git a/unbound_run.sh b/unbound_run.sh index a5189e0..665adc0 100755 --- a/unbound_run.sh +++ b/unbound_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -o errexit -o nounset RUNDIR="$(dirname "$0")" -- GitLab From 4892448c0aa36edcd95fd25bb626408e7e5de87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oto=20=C5=A0=C5=A5=C3=A1va?= <oto.stava@nic.cz> Date: Mon, 5 Aug 2024 10:53:07 +0200 Subject: [PATCH 2/3] .gitlab-ci.yml: use the new knot-resolver-ci image --- .gitlab-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2034cdd..3780fba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,14 @@ -image: $CI_REGISTRY/knot/knot-resolver/ci/debian-buster:knot-3.0 variables: LC_ALL: C.UTF-8 + # IMAGE_TAG is a Git branch/tag name from https://gitlab.nic.cz/knot/knot-resolver-ci + # In general, keep it pointing to a tag - use a branch only for development. + # More info in the knot-resolver-ci repository. + IMAGE_TAG: 'v20240606' + IMAGE_PREFIX: '$CI_REGISTRY/knot/knot-resolver-ci' + +image: $IMAGE_PREFIX/debian12-knot_3_3:$IMAGE_TAG + stages: - test -- GitLab From c7b5f2f4e5b26882cdb5577b8f075d40a77869ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oto=20=C5=A0=C5=A5=C3=A1va?= <oto.stava@nic.cz> Date: Mon, 5 Aug 2024 11:25:50 +0200 Subject: [PATCH 3/3] .gitlab-ci.yml: disable jemalloc in kresd `libfaketime` and `jemalloc` is an incompatible combination. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3780fba..d7487c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,7 +71,7 @@ test:comparative:kresd: - git clone --recurse-submodules -j8 --depth=1 https://gitlab.nic.cz/knot/knot-resolver.git /tmp/kresd-local-build - pushd /tmp/kresd-local-build - git log -1 - - meson build_local --default-library=static --prefix=/tmp/.local + - meson build_local --default-library=static -Dmalloc=disabled --prefix=/tmp/.local - ninja -C build_local install - popd # compare results from latest Deckard with results from merge base @@ -95,7 +95,7 @@ test:latest:kresd: - git clone --recurse-submodules -j8 --depth=1 https://gitlab.nic.cz/knot/knot-resolver.git kresd-local-build - pushd kresd-local-build - git log -1 - - meson build_local --default-library=static --prefix="$PWD/../.local" + - meson build_local --default-library=static -Dmalloc=disabled --prefix="$PWD/../.local" - ninja -C build_local install - popd - TMPDIR=$(pwd) PATH=$(pwd)/.local/sbin:$PATH ./kresd_run.sh -n $(nproc) -- GitLab