New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 892348 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Feature



Sign in to add a comment

Expand ${ISOLATE_OUTDIR} in environment variables.

Project Member Reported by robert...@chromium.org, Oct 4

Issue description

Environment variables in swarming task requests may need to refer to the output directory, but this is only expanded in the command itself.
 
Cc: maruel@google.com
Labels: -Type-Bug Type-Feature
i prefer this not to be implemented

instead, i think we should choose a *constant* env var name, e.g. ISOLATE_OUTDIR, and make it available to swarming tasks.
It is simpler than template syntax, expansion and escape syntax.
I am having trouble understanding how this would help our use case, does this mean that in order to set an environment variable that points to a location inside the output directory I would have to write a custom script that copies the contents of one variable to another and then calls the test command?

If so, this change would not be helpful, I could already write a script that takes '${ISOLATE_OUTDIR}' and the test command, exports the variable and calls the wrapped command. The whole point of this feature request is to be able to set this variable by only adding information to the swarming task request rather than modifying the payload.
Cc: st...@chromium.org
+stgao
Cc: -maruel@google.com
Owner: mar...@chromium.org
Status: Assigned (was: Untriaged)
IMO, if we were to export ISOLATE_OUTDIR as an environment variable, Swarming's "runner" script could do that. However, we can't request all tests to understand this var name. It is still handy to support a template.
What's the downside of expanding env vars? We already expand vars in command line already.

Our use case for code coverage is to set following env. We can't expect Clang to understand ISOLATE_OUTDIR.
   CLANG_CODE_COVERAGE_DIR=$(ISOLATE_OUTDIR}/coverage

On the other hand, we don't want to write a wrapper script to run all the tests in our CQ. If a wrapper script is the direction to go, I think Swarming should take care of this instead.

Since this is a P0 blocker on our end, I'd assign to maruel@ for a decision.
A Google search for "CLANG_CODE_COVERAGE_DIR" leads to nothing. What is accepting this environment variable?
LLVM_PROFILE_FILE is the actual variable name
Thanks Roberto, if you think scaling this to python script (I'm thinking of test_env.py) would be too much work I'm fine with implementing this .

https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program

https://cs.chromium.org/chromium/src/testing/test_env.py
Project Member

Comment 8 by bugdroid1@chromium.org, Oct 8

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-py.git/+/656db1ac23505b56f46a64fbb1b2e82b76ce41c6

commit 656db1ac23505b56f46a64fbb1b2e82b76ce41c6
Author: Roberto Carrillo <robertocn@google.com>
Date: Mon Oct 08 22:30:24 2018

[run_isolated] Replace parameters in environment variables.

Environment variables specified in a swarming request may need to refer
to the isolated out directory, just like parameters to the command do.

This change applies to env variable values the same logic used to inject
to the command the values of isolated out directory, executable
extension, etc.

Bug:  892348 
Change-Id: I8507f0c96b723ae2eb32afef2a43e58e5bb5f509
R=maruel,vadimsh,stgao
Reviewed-on: https://chromium-review.googlesource.com/c/1265140
Commit-Queue: Roberto Carrillo <robertocn@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>

[modify] https://crrev.com/656db1ac23505b56f46a64fbb1b2e82b76ce41c6/appengine/swarming/doc/Magic-Values.md
[modify] https://crrev.com/656db1ac23505b56f46a64fbb1b2e82b76ce41c6/client/run_isolated.py
[modify] https://crrev.com/656db1ac23505b56f46a64fbb1b2e82b76ce41c6/client/tests/run_isolated_test.py

Cc: mar...@chromium.org
Owner: robert...@chromium.org
Status: Fixed (was: Assigned)
Fix is live.

Sign in to add a comment