Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tests/gui_test_parity_quote_body.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
24 changes: 16 additions & 8 deletions tests/gui_test_parity_trust_body.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ".." }
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/gui_test_retention_body.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def readText = { File f -> f.isFile() ? f.getText("UTF-8") : "<missing " + f.pat
fx { dlg.setters["gate"](gate10) }
run(dlg)
def table = json(new File(newest(runsRoot), "run.json")).results.find { it.type == "table" }
expect("RET-10_the_reported_path_is_under_results_and_has_the_data", table != null && new File(table.path as String).isFile() && (table.path as String).startsWith(resultsRoot.path + "/") && new File(table.path as String).text.contains("1,x"), table)
expect("RET-10_the_reported_path_is_under_results_and_has_the_data", table != null && new File(table.path as String).isFile() && new File(table.path as String).toPath().normalize().startsWith(resultsRoot.toPath().normalize()) && new File(table.path as String).text.contains("1,x"), table)
fx { dlg.stage.hide() }
Thread.sleep(500); settle()
expect("RET-10_the_file_is_still_there_after_the_window_closed", new File(table.path as String).isFile() && new File(new File(table.path as String).parentFile, ".lc-done.json").isFile(), table.path)
Expand Down
1 change: 1 addition & 0 deletions tests/smoke_os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ verdict smoke_jar '^SMOKE OK'
if grep -q 'no gui' "$summary"; then echo "QuPath did not run the script: the other steps are skipped"; echo "| (other steps) | skipped: QuPath did not run the script |" >> "$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"
Expand Down
Loading