Skip to content

Commit b4dfe7c

Browse files
committed
attempt to debug test failure on reproducible-builds.org
1 parent 03af16c commit b4dfe7c

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

tests/env2.cwl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cwlVersion: v1.0
2+
class: CommandLineTool
3+
inputs: []
4+
requirements:
5+
ShellCommandRequirement: {}
6+
baseCommand: echo
7+
arguments:
8+
- valueFrom: >
9+
{\\"env_listing\\": \\"\$(env)\\"}
10+
shellQuote: False
11+
stdout: cwl.output.json
12+
outputs:
13+
env_listing: string

tests/test_examples.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from cwltool.resolver import Path
2323
from cwltool.process import CWL_IANA
2424
from cwltool.sandboxjs import JavascriptException
25-
from .util import (get_data, get_main_output, get_windows_safe_factory,
25+
from .util import (get_data, get_main_output, get_windows_safe_factory, subprocess,
2626
needs_docker, working_directory, needs_singularity, temp_dir, windows_needs_docker)
2727

2828
import six
@@ -1011,13 +1011,33 @@ def test_env_filtering(factor):
10111011
commands.extend([get_data(test_file)])
10121012
error_code, stdout, stderr = get_main_output(commands)
10131013

1014+
process = subprocess.Popen(["sh", "-c", r"""getTrueShellExeName() {
1015+
local trueExe nextTarget 2>/dev/null
1016+
trueExe=$(ps -o comm= $$) || return 1
1017+
[ "${trueExe#-}" = "$trueExe" ] || trueExe=${trueExe#-}
1018+
[ "${trueExe#/}" != "$trueExe" ] || trueExe=$([ -n "$ZSH_VERSION" ] && which -p "$trueExe" || which "$trueExe")
1019+
while nextTarget=$(readlink "$trueExe"); do trueExe=$nextTarget; done
1020+
printf '%s\n' "$(basename "$trueExe")"
1021+
} ; getTrueShellExeName"""], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None)
1022+
sh_name, sh_name_err = process.communicate()
1023+
sh_name = sh_name.decode('utf-8').strip()
1024+
10141025
assert "completed success" in stderr, (error_code, stdout, stderr)
10151026
assert error_code == 0, (error_code, stdout, stderr)
10161027
if onWindows():
10171028
target = 5
1018-
else:
1029+
elif sh_name == "dash":
10191030
target = 4
1020-
assert json.loads(stdout)['env_count'] == target, (error_code, stdout, stderr)
1031+
else:
1032+
target = 6
1033+
result = json.loads(stdout)['env_count']
1034+
details = ''
1035+
if result != target:
1036+
_, details, _ = get_main_output(["--quiet", get_data("tests/env2.cwl")])
1037+
print(sh_name)
1038+
print(sh_name_err)
1039+
print(details)
1040+
assert result == target, (error_code, sh_name, sh_name_err, details, stdout, stderr)
10211041

10221042
@windows_needs_docker
10231043
def test_v1_0_arg_empty_prefix_separate_false():

0 commit comments

Comments
 (0)