diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 02:24:05 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-11-02 02:24:05 +0100 |
| commit | e2fe861be75ce3d815d4da9122b1821eb099d6fd (patch) | |
| tree | 75d2f792b48e516f1ba5486654c767c1f9ad7384 /tests | |
| parent | a0569d2d3cdca5d6ed78e0df77b08ccbbec52570 (diff) | |
add test for the version report fascilities
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/integration/test_version.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/integration/test_version.py b/tests/integration/test_version.py new file mode 100644 index 0000000..66f570d --- /dev/null +++ b/tests/integration/test_version.py | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | """The -v report, which is where a build says what went into it. | ||
| 2 | |||
| 3 | Driving the binary is the only way to see this: the feature list is a table | ||
| 4 | of #ifdefs, so it is only true for the flags the binary itself was built with. | ||
| 5 | """ | ||
| 6 | |||
| 7 | import subprocess | ||
| 8 | import unittest | ||
| 9 | |||
| 10 | from harness import TRACKER | ||
| 11 | |||
| 12 | |||
| 13 | class VersionFlag(unittest.TestCase): | ||
| 14 | def report(self): | ||
| 15 | # -v writes to stderr and exits before it binds anything | ||
| 16 | done = subprocess.run([TRACKER, "-v"], capture_output=True, timeout=30) | ||
| 17 | self.assertEqual(done.returncode, 0, done.stderr) | ||
| 18 | return done.stderr.decode() | ||
| 19 | |||
| 20 | def test_first_line_names_the_release(self): | ||
| 21 | # The commit in brackets is there in a checkout and in a release | ||
| 22 | # tarball, and absent in a build that had neither to ask. | ||
| 23 | first = self.report().splitlines()[0] | ||
| 24 | self.assertRegex(first, r"^opentracker \d+\.\d+\.\d+( \(\S+\))?$") | ||
| 25 | |||
| 26 | def test_names_the_event_mechanism(self): | ||
| 27 | self.assertRegex(self.report(), r"(?m)^events: (epoll|kqueue|poll)$") | ||
| 28 | |||
| 29 | def test_lists_the_features_this_build_has(self): | ||
| 30 | # The Makefile builds this binary with these and not with those, so a | ||
| 31 | # feature table that stops following the build fails here. | ||
| 32 | report = self.report() | ||
| 33 | for want in ("WANT_KEEPALIVE", "WANT_ACCESSLIST_BLACK", "WANT_DYNAMIC_ACCESSLIST"): | ||
| 34 | self.assertIn(want, report) | ||
| 35 | for unwanted in ("WANT_SPOT_WOODPECKER", "WANT_V4_ONLY", "WANT_RESTRICT_STATS"): | ||
| 36 | self.assertNotIn(unwanted, report) | ||
