[Git][NTPsec/ntpsec][master] 3 commits: Make the CI jobs more correct in function

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Tue Aug 12 00:20:55 UTC 2025



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
4697d70e by James Browning at 2025-08-11T17:16:59-07:00
Make the CI jobs more correct in function

- - - - -
b4aa2029 by James Browning at 2025-08-11T17:16:59-07:00
wafhelpers/bin_test.py: never set PYTHONPATH ...

- test installed files only when DESTDIR unset
- test built files only for bin_test, build, and check ATM.
- otherwise do not run bin_test

We set PYTHONPATH to the built module distorting the results.
We also set PATH to the target folder, warping results.
Stop doing those and document a little better.

- - - - -
16dbe2b0 by James Browning at 2025-08-11T17:16:59-07:00
CI: Update four Debian jobs

- Bump Python minor by two for debian-{,old}stable-basic
- Move AsciiDoc-classic2-Debian-Old to python2
- Move debian-oldstable-options-tester to debian:oldoldstable

- - - - -


2 changed files:

- .gitlab-ci.yml
- wafhelpers/bin_test.py


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -2,6 +2,7 @@ pages:
   stage: build
   image: $CI_REGISTRY/ntpsec/ntpsec/alpine-pages
   script:
+    - echo /tmp/docbot-local/lib/python3.12/site-packages > /usr/lib/python3.12/site-packages/ntpsec.pth
     - mkdir -p public/latest
     - python3 ./waf configure --prefix=/tmp/docbot-local --htmldir=`pwd`/public/latest/ --enable-doc --disable-manpage build install
     - tar -C /tmp/docbot-local/share/doc/ntpsec/ -cf - .|tar -C public/latest/ -xf -
@@ -30,10 +31,20 @@ include:
   tags:
     - gitlab-org
 
+prisoner-0:
+  <<: *job_definition
+  image: $CI_REGISTRY/ntpsec/ntpsec/alpine
+  script:
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
+    - DESTDIR=prison python3 ./waf install uninstall
+    - DESTDIR=build/prison python3 ./waf install uninstall
+    - DESTDIR=../prison python3 ./waf install uninstall
+
 alpine-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/alpine
   script:
+    - echo /usr/local/lib/python3.12/site-packages > /usr/lib/python3.12/site-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -49,6 +60,7 @@ alpine-edge-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/alpine-edge
   script:
+    - echo /usr/local/lib/python3.12/site-packages > /usr/lib/python3.12/site-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -72,7 +84,7 @@ alpine-edge-refclocks:
 #     - ln -sv src/asciidoc3.py asciidoc3/asciidoc3
 #     - asciidoc3/asciidoc3 --version || echo -n
 #     - PATH="$PWD/asciidoc3:$PATH" python3 ./waf configure --enable-warnings --enable-Werror --enable-doc --enable-manpage build
- 
+
 AsciiDoc-py3-Alpine:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/alpine
@@ -93,7 +105,7 @@ AsciiDoc-classic3-Debian-Old:
   script:
     - apt-get update
     - DEBIAN_FRONTEND="noninteractive" apt-get install -y python3-dev asciidoc-base
-    - python3 ./waf configure --enable-warnings --enable-Werror --enable-doc --enable-manpage build --disable-nts
+    - python3 ./waf configure --enable-warnings --enable-Werror --enable-doc --enable-manpage build --disable-nts --pyshebang "/usr/bin/env python3"
 
 AsciiDoc-classic-Python2:
   <<: *job_definition
@@ -101,12 +113,13 @@ AsciiDoc-classic-Python2:
   script:
     - apt-get update
     - DEBIAN_FRONTEND="noninteractive" apt-get install -y python2-dev asciidoc-base
-    - python2 ./waf configure --enable-warnings --enable-Werror --enable-doc --enable-manpage build --disable-nts
+    - python2 ./waf configure --enable-warnings --enable-Werror --enable-doc --enable-manpage build --disable-nts --pyshebang "/usr/bin/env python3"
 
 debian-oldstable-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-oldstable
   script:
+    - echo /usr/local/lib/python3.11/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --disable-nts build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -115,12 +128,13 @@ debian-oldstable-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-oldstable
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --disable-nts --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --disable-nts --refclock=all build --pyshebang "/usr/bin/env python3"
 
 debian-stable-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-stable
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -129,12 +143,13 @@ debian-stable-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-stable
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 debian-testing-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-testing
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -143,13 +158,14 @@ debian-testing-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-testing
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 debian-unstable-basic:
   allow_failure: true
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-unstable
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -159,12 +175,13 @@ debian-unstable-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-unstable
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 ubuntu-latest-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-latest
   script:
+    - echo /usr/local/lib/python3.12/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -173,13 +190,14 @@ ubuntu-latest-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-latest
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 ubuntu-devel-basic:
   <<: *job_definition
   allow_failure: true
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-devel
   script:
+    - echo /usr/local/lib/python3.9/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -189,12 +207,13 @@ ubuntu-devel-refclocks:
   allow_failure: true
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-devel
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 ubuntu-rolling-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-rolling
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -203,7 +222,7 @@ ubuntu-rolling-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/ubuntu-rolling
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 freebsd-basic:
   <<: *job_definition
@@ -221,7 +240,7 @@ freebsd-basic:
 freebsd-refclocks:
   <<: *job_definition
   script:
-    - python ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
   tags:
     - freebsd
   rules:
@@ -239,7 +258,7 @@ centos-latest-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/centos-latest
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 fedora-latest-basic:
   <<: *job_definition
@@ -273,6 +292,7 @@ clang-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/clang
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3/dist-packages/ntpsec.pth
     - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --check-c-compiler=clang build --pyshebang "/usr/bin/env python3"
     - python3 ./waf install
     - python3 ./waf uninstall
@@ -281,7 +301,7 @@ clang-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/clang
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --check-c-compiler=clang --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --check-c-compiler=clang --refclock=all build --pyshebang "/usr/bin/env python3"
 
 openSUSE-leap-basic:
   <<: *job_definition
@@ -295,7 +315,7 @@ openSUSE-leap-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/opensuse-leap
   script:
-    - python3 ./waf configure --enable-warnings --disable-doc --disable-manpage --disable-nts --refclock=all build
+    - python3 ./waf configure --enable-warnings --disable-doc --disable-manpage --disable-nts --refclock=all build --pyshebang "/usr/bin/env python3"
 
 # debian-stable-basic-32bit:
 #   <<: *job_definition
@@ -313,13 +333,13 @@ debian-stable-mDNS-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-stable-mdns
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build --pyshebang "/usr/bin/env python3"
 
 debian-stable-mDNS-refclocks:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/debian-stable-mdns
   script:
-    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build
+    - python3 ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build --pyshebang "/usr/bin/env python3"
 
 cross-armhf-build:
   allow_failure: true
@@ -351,13 +371,10 @@ gentoo-basic:
   <<: *job_definition
   image: $CI_REGISTRY/ntpsec/ntpsec/gentoo
   script:
+    - echo /usr/local/lib/python3.13/site-packages/ > /usr/lib/python3.13/site-packages/ntpsec.pth
     - python ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage build
-    - DESTDIR=build/prison python ./waf install
-    - DESTDIR=./prison python ./waf install
-    - DESTDIR=../prison python ./waf install
     - python ./waf install
     - python ./waf uninstall
-    - rm -rvf build/prison ./prison ../prison
 
 gentoo-refclocks:
   <<: *job_definition
@@ -397,7 +414,7 @@ macos-basic:
 macos-refclocks:
   <<: *job_definition
   script:
-    - PKG_CONFIG_PATH=${HOMEBREW_PREFIX}/opt/openssl/lib/pkgconfig python ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build || cat build/config.log
+    - PKG_CONFIG_PATH=${HOMEBREW_PREFIX}/opt/openssl/lib/pkgconfig python ./waf configure --enable-warnings --enable-Werror --disable-doc --disable-manpage --refclock=all build  --pyshebang "/usr/bin/env python3" || cat build/config.log
   tags:
     - saas-macos-medium-m1
   rules:


=====================================
wafhelpers/bin_test.py
=====================================
@@ -2,7 +2,15 @@
 #
 # SPDX-License-Identifier: BSD-2-Clause
 
-"""Run a suite of tests on the listed binaries."""
+"""Run a suite of tests on the listed binaries.
+
+| command | DESTDIR | value | tests |
+| === | === | === | === |
+| bin_test, build, check | n/a | False as TEST_BUILD | build/main |
+| install | no | True as TEST_INSTALL | $PREFIX/bin, $PREFIX/sbin |
+| install | yes | None as TEST_NO | nothing |
+| * | n/a | None as TEST_NO | nothing |
+"""
 from __future__ import print_function
 import os
 import os.path
@@ -17,6 +25,9 @@ NTPD = "main/ntpd"
 NTPFROB = "main/ntpfrob"
 NTPTIME = "main/ntptime"
 POPEN = waflib.Utils.subprocess.Popen
+TEST_BUILD = 0
+TEST_NO = 1
+TEST_INSTALL = 2
 
 test_logs = []
 
@@ -32,7 +43,7 @@ def bin_test_summary(_ctx):
         waflib.Logs.pprint(i[0], i[1])
 
 
-def run(cmd, expected, python=None):
+def run(cmd, expected):
     """Run an individual test."""
     prefix = "running: " + " ".join(cmd)
 
@@ -40,11 +51,7 @@ def run(cmd, expected, python=None):
         addLog("YELLOW", prefix + " SKIPPING (does not exist)")
         return None
 
-    if python:
-        cmd = [python[0]] + list(cmd)
-    p = POPEN(cmd, env={'PATH': os.environ['PATH'],
-                        'PYTHONPATH': '%s/main/tests/pylib' %
-                        waflib.Context.out_dir},
+    p = POPEN(cmd, env={"PATH": os.environ["PATH"]},
               universal_newlines=True,
               stdin=waflib.Utils.subprocess.PIPE,
               stdout=waflib.Utils.subprocess.PIPE,
@@ -65,11 +72,35 @@ def run(cmd, expected, python=None):
     return False
 
 
-def etl_cases(installed, version, params):
+def do_we_test(ctx):
+    """Evaluate if we should test and how."""
+    if ctx.cmd in ["build", "check", "bin_test"]:
+        return TEST_BUILD
+    if ctx.cmd == "install":
+        if bool(waflib.Options.options.destdir):
+            waflib.Logs.pprint(
+                "YELLOW", "bin_test disabled in DESTDIR installs."
+            )
+            return TEST_NO
+        return TEST_INSTALL
+    if "uninstall" == ctx.cmd:
+        return TEST_NO
+    # Probably add more cases here...
+    waflib.Logs.pprint(
+        "RED", "Please report that bin_test is broken for `./waf %s`!"
+        % ctx.cmd
+    )
+    sys.exit(1)
+
+
+def etl_cases(ctx, version, params):
     """Convert cmd_list_* to run() arguments."""
     ret = []
+    installed = do_we_test(ctx)
+    if installed is TEST_NO:
+        return []
     for dest_dir, bld_dir, name, flag in params:
-        if not installed:
+        if installed != TEST_INSTALL:
             prefix = waflib.Context.out_dir + os.sep + bld_dir
         else:
             prefix = waflib.Options.options.destdir + dest_dir
@@ -117,12 +148,11 @@ def cmd_bin_test(ctx):
     if ctx.env['PYTHON_CURSES']:
         cmd_list_python += cmd_list_python_curses
 
-    INSTALL = bool('install' == ctx.cmd)
-    for cmd in etl_cases(INSTALL, version, cmd_list):
+    for cmd in etl_cases(ctx, version, cmd_list):
         rets.append(run(cmd[0], cmd[1]))
     if 'none' != ctx.env['ntpc']:
-        for cmd in etl_cases(INSTALL, version, cmd_list_python):
-            rets.append(run(cmd[0], cmd[1], ctx.env['PYTHON']))
+        for cmd in etl_cases(ctx, version, cmd_list_python):
+            rets.append(run(cmd[0], cmd[1]))
 
     def test_s(number):
         """Return values for string formatting."""
@@ -130,10 +160,13 @@ def cmd_bin_test(ctx):
 
     skips = sum(int(None is i) for i in rets)
     fails = sum(int(False is i) for i in rets)
-    if fails:
-        bin_test_summary(ctx)
     if skips:
         waflib.Logs.pprint('YELLOW', "%d binary test%s skipped!"
                            % test_s(skips))
     if fails:
-        ctx.fatal("%d binary test%s failed!" % test_s(fails))
+        # on failure print number of failed tests and the summary
+        waflib.Logs.pprint(
+            "RED", "%d binary test%s failed!" % test_s(fails)
+        )
+        bin_test_summary(ctx)
+        sys.exit(1)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/a56c0197c5383c33351c67c6f67378f677d6ee52...16dbe2b07bc70b37e73aa76f850db2705f7c5dd9

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/a56c0197c5383c33351c67c6f67378f677d6ee52...16dbe2b07bc70b37e73aa76f850db2705f7c5dd9
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20250812/015e9008/attachment-0001.htm>


More information about the vc mailing list