Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error reporting when test step fails #4443

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

boegel
Copy link
Member

@boegel boegel commented Jan 19, 2024

Without the fix, test fails with:

Traceback (most recent call last):
  File "/Volumes/work/easybuild-framework/test/framework/toy_build.py", line 4140, in test_toy_failing_test_step
    self.assertErrorRegex(EasyBuildError, error_pattern, self.run_test_toy_build_with_output,
  File "/Volumes/work/easybuild-framework/easybuild/base/testing.py", line 164, in assertErrorRegex
    call(*args, **kwargs)
  File "/Volumes/work/easybuild-framework/test/framework/toy_build.py", line 239, in run_test_toy_build_with_output
    self._test_toy_build(*args, **kwargs)
  File "/Volumes/work/easybuild-framework/test/framework/toy_build.py", line 195, in _test_toy_build
    raise myerr
  File "/Volumes/work/easybuild-framework/test/framework/toy_build.py", line 190, in _test_toy_build
    outtxt = self.eb_main(args, logfile=self.dummylogfn, do_build=True, verbose=verbose,
  File "/Volumes/work/easybuild-framework/test/framework/utilities.py", line 341, in eb_main
    raise myerr
  File "/Volumes/work/easybuild-framework/test/framework/utilities.py", line 314, in eb_main
    main(args=main_args, logfile=logfile, do_build=do_build, testing=testing, modtool=modtool)
  File "/Volumes/work/easybuild-framework/easybuild/main.py", line 727, in main
    do_cleanup = process_eb_args(orig_paths, eb_go, cfg_settings, modtool, testing, init_session_state,
  File "/Volumes/work/easybuild-framework/easybuild/main.py", line 564, in process_eb_args
    ecs_with_res = build_and_install_software(ordered_ecs, init_session_state,
  File "/Volumes/work/easybuild-framework/easybuild/main.py", line 173, in build_and_install_software
    raise ec_res['err']
  File "/Volumes/work/easybuild-framework/easybuild/main.py", line 134, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
  File "/Volumes/work/easybuild-framework/easybuild/framework/easyblock.py", line 4428, in build_and_install_one
    succ = "unsuccessfully: " + error_msg
TypeError: can only concatenate str (not "RunShellCmdError") to str

Same happens when running an installation that fails in test step.

With this fix, the error reporting is as expected:

== testing...
  >> running command:
        [started at: 2024-01-19 20:06:22]
        [working dir: /tmp/example/1.2.3/system-system/example-1.2.3]
        [output saved to /tmp/eb-vadju77_/run-shell-cmd-output/command_that_fails-9f3cvv7b/out.txt]
        command_that_fails

ERROR: Shell command failed!
    full command              ->  command_that_fails
    exit code                 ->  2
    working directory         ->  /tmp/example/1.2.3/system-system/example-1.2.3
    output (stdout + stderr)  ->  /tmp/eb-vadju77_/run-shell-cmd-output/command_that_fails-9f3cvv7b/out.txt
    called from               ->  'test_step' function in /Users/kehoste/work/easybuild-easyblocks/easybuild/easyblocks/generic/configuremake.py (line 376)

== ... (took < 1 sec)
== FAILED: Installation ended unsuccessfully: shell command 'command_that_fails ...' failed in test step for example-1.2.3.eb (took 5 secs)

@boegel boegel added bug fix EasyBuild-5.0 EasyBuild 5.0 labels Jan 19, 2024
@boegel boegel added this to the 5.0 milestone Jan 19, 2024
@boegel boegel force-pushed the fix_error_reporting_test_step branch from fe0a520 to 77e077e Compare January 19, 2024 21:38
@branfosj branfosj merged commit 80c9718 into easybuilders:5.0.x Jan 20, 2024
34 checks passed
@boegel boegel deleted the fix_error_reporting_test_step branch January 20, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants