Skip to content

Commit 5ff1307

Browse files
committed
test suite: don't exit with success by another error as "invalid argument"
(consider cross-platform build), e. g. test suite shall fail in case of "no such file or directory"
1 parent d10c80b commit 5ff1307

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/7z.tcl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ if {![info exists Z7_PATH]} {
2626
}}
2727
}
2828
puts "Test 7z-path: $Z7_PATH"
29-
if {[catch {exec $Z7_PATH} res]} {
30-
puts "Cannot test using \"$Z7_PATH\" (invalid platform?): $res"
31-
exit 0
32-
}
29+
30+
# ensure we can test using executable from $Z7_PATH (valid platform, e. g. bypass cross-platform build):
31+
apply {{} {
32+
variable Z7_PATH
33+
if {[catch {exec $Z7_PATH} res opt]} {
34+
puts "Cannot test using \"$Z7_PATH\" (invalid platform?): $res"
35+
# 0 - by "invalid argument" (invalid platform), 1 - by other (unexpected) error
36+
exit [expr {![string match {POSIX EINVAL *} [dict get $opt -errorcode]]}]
37+
}
38+
}}
3339

3440
proc 7z {args} {
3541
variable Z7_PATH

0 commit comments

Comments
 (0)