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 environments in test_persistent_tasks #240

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

lgoettgens
Copy link
Collaborator

On the CI testing setup of AbstractAlgebra.jl, I got the following error in the sub-process of test_persistent_tasks. (log)

ERROR: ArgumentError: Package Pkg not found in current path.
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

After some digging around, I found that LOAD_PATH was just ["@", "/tmp/jl_yzJAOE"] there, so that's the reason why Pkg could not be found. The easiest (and only) solution I could find, was to clear the ENV of the sub-process explicitly to allow a default value for LOAD_PATH to populate (see https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_LOAD_PATH).

Furthermore, this PR allows errors in the sub-process to show up in the stderr of the main process.

@lgoettgens lgoettgens added bug Something isn't working test: persistent tasks labels Nov 16, 2023
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0f04e76) 76.24% compared to head (0e439ea) 76.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #240      +/-   ##
==========================================
+ Coverage   76.24%   76.27%   +0.03%     
==========================================
  Files          11       11              
  Lines         783      784       +1     
==========================================
+ Hits          597      598       +1     
  Misses        186      186              
Flag Coverage Δ
unittests 76.27% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lgoettgens lgoettgens merged commit 5fb04b7 into JuliaTesting:master Nov 16, 2023
25 checks passed
@lgoettgens lgoettgens deleted the lg/env branch November 16, 2023 13:45
@@ -152,7 +152,8 @@ end
end
# Precompile the wrapper package
cmd = `$(Base.julia_cmd()) --project=$wrapperdir -e 'using Pkg; Pkg.precompile()'`
proc = run(cmd; wait = false)
cmd = setenv(cmd, String[])
Copy link

@benlorenz benlorenz Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clears all environment variables for the subprocess, among other PATH and Polymake.jl for example relies on that being non-empty (which is imho a reasonable assumption). Also it might break running any other shell commands from the package initialization.

See for example here: https://github.com/oscar-system/Polymake.jl/actions/runs/6891113309/job/18747915661?pr=461#step:7:478

ERROR: LoadError: InitError: KeyError: key "PATH" not found
Stacktrace:
  [1] (::Base.var"#717#718")(k::String)
    @ Base ./env.jl:138
  [2] access_env
    @ Base ./env.jl:43 [inlined]
  [3] getindex
    @ Base ./env.jl:138 [inlined]
  [4] __init__()
    @ Polymake ~/work/Polymake.jl/Polymake.jl/src/Polymake.jl:187

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, what a bummer...
I'll test around with Polymake.jl then a try to get a 0.8.2 running that's fine with both Polymake.jl and AbstractAlgebra.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test: persistent tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants