From c06a0130bc6936c92b43cdab9b26c95040efd5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Hidalgo?= <47150974+IvanHCenalmor@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:48:34 +0200 Subject: [PATCH] os-smoke on Windows: the three failing test bodies are fixed in the tests The Windows smoke job (release.yml, continue-on-error) failed on every release from alpha.1 to alpha.7 with the same three bodies. In each case the extension behaves as intended on Windows; the tests assumed a POSIX machine. - quote: the POSIX terminal-command check read the real OS, so on Windows it got the (correct) Windows line. It now sets os.name to Linux, like its Windows twin sets it to Windows. - trust: six checks (group/other write bits, schema next to the entry) are POSIX-only by contract (Tools HOST_PARITY trust vectors, posix_only; the Python registry checks them under os.name == "posix"). They are skipped on Windows with a printed NOTE. The prefix-is-root and outside-prefix checks apply everywhere but used /bin/sh, which does not exist on Windows; they now use ComSpec (cmd.exe) and its drive root there. - retention RET-10: the path was compared with resultsRoot.path + "/", but Windows paths use backslashes. It now compares Paths. release.yml: a pull request that changes tests/smoke_* , ci_setup_os.sh or one of the four bodies smoke_os.sh runs now gets the release dry run too. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 4 +++- tests/gui_test_parity_quote_body.groovy | 4 +++- tests/gui_test_parity_trust_body.groovy | 24 ++++++++++++++++-------- tests/gui_test_retention_body.groovy | 2 +- tests/smoke_os.sh | 1 + 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b134c6c..9831fc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,9 @@ name: release # Manually (workflow_dispatch, input "tag") or on a pull request that changes this machinery it is a dry run: build, smoke test, files kept as workflow artifacts, nothing is published. on: pull_request: # a dry run when the release machinery itself changes (never publishes) - paths: [".github/workflows/release.yml", "build.sh", "tests/smoke_jar.*"] + # the files the smoke jobs run: tests/smoke_os.sh and the test bodies it lists, so a change to them is checked on Windows and macOS too + paths: [".github/workflows/release.yml", "build.sh", "tests/smoke_*", "tests/ci_setup_os.sh", + "tests/gui_test_parity_quote_body.groovy", "tests/gui_test_parity_trust_body.groovy", "tests/gui_test_parity_lifecycle_body.groovy", "tests/gui_test_retention_body.groovy"] release: types: [published] workflow_dispatch: diff --git a/tests/gui_test_parity_quote_body.groovy b/tests/gui_test_parity_quote_body.groovy index a84a447..8019b60 100644 --- a/tests/gui_test_parity_quote_body.groovy +++ b/tests/gui_test_parity_quote_body.groovy @@ -97,7 +97,9 @@ Thread.start("lc-gui-test") { try { System.setProperty("os.name", "Windows 11"); line = fx { dlg.copyAsCommand("terminal") } } finally { System.setProperty("os.name", realOs) } def words = parseWindows(line.readLines().findAll { !it.startsWith("#") }.join(" ")) expect("windows_terminal_command_gives_the_program_the_typed_value", words.contains("shape=" + typed), [line, words]) - def posixLine = fx { dlg.copyAsCommand("terminal") } + // the same with the operating system set to a POSIX one (the dialog quotes for the machine it runs on: on Windows the real OS gives the Windows line) + def posixLine + try { System.setProperty("os.name", "Linux"); posixLine = fx { dlg.copyAsCommand("terminal") } } finally { System.setProperty("os.name", realOs) } expect("posix_terminal_command_gives_the_shell_the_typed_value", parsePosix(posixLine.readLines().findAll { !it.startsWith("#") }.join(" ")).contains("shape=" + typed), posixLine) } catch (Throwable t) { t.printStackTrace(); results["EXCEPTION"] = false } finally { println "RESULTS " + results; Thread.sleep(500); System.exit(results && results.every { it.value } ? 0 : 1) } diff --git a/tests/gui_test_parity_trust_body.groovy b/tests/gui_test_parity_trust_body.groovy index a71814c..fe5a1dd 100644 --- a/tests/gui_test_parity_trust_body.groovy +++ b/tests/gui_test_parity_trust_body.groovy @@ -52,8 +52,12 @@ mk("trust_interp_world_writable") { e, p -> chmod("777", p[2]) } mk("trust_interp_folder_world_writable") { e, p -> chmod("777", p[1]) } mk("trust_prefix_world_writable") { e, p -> chmod("777", p[0]) } mk("trust_sticky_folder_ok") { e, p -> chmod("1777", p[1]) } -mk("trust_prefix_is_root") { e, p -> e.prefix = "/"; e.python = "/bin/sh" } -mk("trust_interp_outside_prefix") { e, p -> e.python = "/bin/sh" } +// a program that exists on this machine (the registry refuses a missing interpreter before it looks at the prefix) and the root of its file system +def posix = LcRegistry.isPosixHost() +def hostProgram = posix ? "/bin/sh" : (System.getenv("ComSpec") ?: "C:\\Windows\\System32\\cmd.exe") +def hostRoot = new File(hostProgram).toPath().root.toString() +mk("trust_prefix_is_root") { e, p -> e.prefix = hostRoot; e.python = hostProgram } +mk("trust_interp_outside_prefix") { e, p -> e.python = hostProgram } mk("trust_interp_missing") { e, p -> e.python = new File(p[1], "nothere").path } mk("trust_name_with_slash") { e, p -> e.name = "../evil" } mk("trust_name_dotdot") { e, p -> e.name = ".." } @@ -106,12 +110,16 @@ def refused = { String name, String needle -> expect("trust_ok_loads", loaded.contains("trust_ok") && problemOf("trust_ok") == null, problems) expect("trust_ok_tool_id_with_dot_and_dash_loads", registry.apps["trust_ok"]?.schema?.tools?[0]?.id == "t.one-2") expect("trust_sticky_folder_is_not_world_writable", loaded.contains("trust_sticky_folder_ok"), problemOf("trust_sticky_folder_ok")) -refused("trust_group_writable_entry", "entry file is writable by other users") -refused("trust_group_writable_schema", "schema file is writable by other users") -refused("trust_schema_elsewhere", "is not in the same folder as the entry") -refused("trust_interp_world_writable", "interpreter " + new File(prefixes, "trust_interp_world_writable/bin/python").path + " is writable by everybody") -refused("trust_interp_folder_world_writable", "interpreter folder") -refused("trust_prefix_world_writable", "install prefix") +// POSIX-only rules (the trust vectors of LabConstrictor-Tools docs/HOST_PARITY.md mark them posix_only; the Python registry checks them under os.name == "posix"): +// Windows has no group/other permission bits, and the registry skips these checks there on purpose +if (posix) { + refused("trust_group_writable_entry", "entry file is writable by other users") + refused("trust_group_writable_schema", "schema file is writable by other users") + refused("trust_schema_elsewhere", "is not in the same folder as the entry") + refused("trust_interp_world_writable", "interpreter " + new File(prefixes, "trust_interp_world_writable/bin/python").path + " is writable by everybody") + refused("trust_interp_folder_world_writable", "interpreter folder") + refused("trust_prefix_world_writable", "install prefix") +} else println "NOTE POSIX-only checks skipped on " + System.getProperty("os.name") + " (group/other write bits, schema next to the entry): the registry applies these rules on POSIX only, like the Python registry" refused("trust_prefix_is_root", "is a filesystem root") refused("trust_interp_outside_prefix", "is not inside the install prefix") refused("trust_interp_missing", "not available on this machine (interpreter") diff --git a/tests/gui_test_retention_body.groovy b/tests/gui_test_retention_body.groovy index f890133..7f72e77 100644 --- a/tests/gui_test_retention_body.groovy +++ b/tests/gui_test_retention_body.groovy @@ -221,7 +221,7 @@ def readText = { File f -> f.isFile() ? f.getText("UTF-8") : "> "$summary"; [ -z "${GITHUB_STEP_SUMMARY:-}" ] || cat "$summary" >> "$GITHUB_STEP_SUMMARY"; exit 1; fi # 2. OS-specific code paths: each body is appended to the joined script (what tests/run_gui_test.sh does) # bodies that write their own registry get a scratch LC_HOME with the name they assert (no associative array: macOS has bash 3.2) +# the bodies below are also in the pull_request paths of .github/workflows/release.yml (a change to one runs this smoke): keep both lists the same scratch_for() { case "$1" in gui_test_parity_trust_body.groovy) echo lhome_trust;; gui_test_parity_lifecycle_body.groovy) echo lhome_life;; gui_test_retention_body.groovy) echo lhome_retention;; esac; } for body in gui_test_parity_quote_body.groovy gui_test_parity_trust_body.groovy gui_test_parity_lifecycle_body.groovy gui_test_retention_body.groovy; do name="${body%.groovy}"; joined="$LOGS/$name.joined.groovy"