diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-19 21:36:15 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-19 21:36:15 +0200 |
| commit | fc02ae2b562a3c608b41302d84d69b29415b927c (patch) | |
| tree | 9fe27aad03c05eea293352dbffa4a77b8a784efa /tests/test_remote.py | |
| parent | 993950b7733ba9300915955ec6e51e1f21dad806 (diff) | |
| download | sb-builder-fc02ae2b562a3c608b41302d84d69b29415b927c.tar.gz sb-builder-fc02ae2b562a3c608b41302d84d69b29415b927c.zip | |
build-log: show the last attempt's log, not always build.log
slackrepo writes one log per command (build, rebuild, update,
remove). A failed update left build.log from an older successful
build, so the viewer showed a success next to a failed result. The
helper (0.4.1) now returns the newest command log and its name, which
the viewer shows in the title and header.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_remote.py')
| -rw-r--r-- | tests/test_remote.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_remote.py b/tests/test_remote.py index 85e642b..db3d0a1 100644 --- a/tests/test_remote.py +++ b/tests/test_remote.py @@ -489,8 +489,20 @@ class ResultsTest(Base): self.assertEqual(log["build"], "\nERROR: make failed\n"[-20:]) self.assertTrue(log["truncated"]) self.assertEqual(log["resource"], "peak memory 3308M\n") + self.assertEqual(log["name"], "build.log") self.assertIsInstance(log["mtime"], int) + def test_newest_command_log_wins(self): + # slackrepo keeps one log per command: the last attempt may be an update + d = os.path.join(self.cfg["slackrepo_logdir"], "cat", "c") + os.utime(os.path.join(d, "build.log"), (1000, 1000)) + with open(os.path.join(d, "update.log"), "w") as f: + f.write("ERROR: Download failed\n") + with open(os.path.join(d, "config.log"), "w") as f: + f.write("autotools noise\n") + log = sbb.cmd_build_log(self.cfg, "cat/c") + self.assertEqual((log["name"], log["build"]), ("update.log", "ERROR: Download failed\n")) + def test_build_log_rejects(self): for bad in ("../etc/passwd", "cat/../../x", "cat", "cat/a", "/etc/x"): with self.subTest(bad=bad), self.assertRaises(sbb.Error): |
