Commit Graph

17 Commits

Author SHA1 Message Date
Louis Dionne 232d3a3e47 [libc++] Fix codesigning in run.py
Without this patch, we'd always try to codesign the first argument in
the command line, which in some cases is not something we can codesign
(e.g. `bash` for some .sh.cpp tests).

Note that this "hack" is the same thing we do in `ssh.py` - we might need
to admit that it's not a hack after all in the future, but I'm not ready
for that yet.

Differential Revision: https://reviews.llvm.org/D99726
2021-04-01 13:39:49 -04:00
Martin Storsjö 34ee3d91a8 [libcxx] [test] Pass some windows environment variables through to test processes
Normally, the run.py wrapper script runs the child processes in
a clean environment, with only the environment variables available
that are passed via the --env parameter.

However, the COMSPEC and TEMP variables are kind of necessary when
running some tests; COMSPEC is necessary for finding the interpreter
when executing commands via std::system().

Before f1a96de1bc, tests were executed
via an intermediate shell which implicitly readded the COMSPEC variable.

The TEMP variable allows temp files to be placed in a sensible
location; if unset, they're placed in the default temp fallback of
C:\Windows instead.

Differential Revision: https://reviews.llvm.org/D97452
2021-03-02 22:39:14 +02:00
Louis Dionne f1a96de1bc [libc++] Don't run tests in a shell in the default executor 2020-11-04 08:29:05 -05:00
Alex Richardson 3980e8956b [libcxx][lit] Simplify parsing of trailing executor arguments
Adding a positional argparse.ONE_OR_MORE arguments will correctly remove
the "--" separator after --env and parse only the command. This also has
the advantage that misspelled flags raise an argparse error rather than
silently being added to the command to be executed.

I discovered this while adding a new commandline option to ssh.py to allow
passing additional arguments to the scp/ssh commands since this is required
for our CHERI CI where we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84096
2020-07-21 09:03:45 +01:00
Louis Dionne f998e0d679 [libc++] Make executor scripts executable
This allows running the scripts directly, without running them through
Python.
2020-06-12 10:29:04 -04:00
Louis Dionne 1fc5010d6b [libc++] Consider everything inside %T to be a dependency of each test
Instead of passing file dependencies individually, assume that the
whole content of the unique test directory is a dependency. This
simplifies the test harness significantly, by making %T the directory
that contains everything required to run a test. This also removes the
need for the %{file_dependencies} substitution, which is removed by this
patch.

Furthermore, this patch also changes the harness to execute tests locally
inside %T, so as to avoid creating a separate directory for no purpose.
2020-06-10 22:38:05 -04:00
Louis Dionne 5eb8d45ab5 [libc++] Use proper shell escaping in the executors
This was originally committed as f8452ddfcc and reverted in 7cb1aa9d93.
The issue was that shell builtins were being escaped too, and apparently
Bash won't execute a builtin when it is quoted e.g. '!'. Instead, it
thinks it's a command and it can't find it.

Re-committing the change with that issue fixed.
2020-04-18 11:22:42 -04:00
Louis Dionne 7cb1aa9d93 Revert "[libc++] Use proper shell escaping in the executors"
This reverts f8452ddfcc, which broke some bots. I'll figure out what's
wrong and commit it again.
2020-04-17 17:06:52 -04:00
Louis Dionne f8452ddfcc [libc++] Use proper shell escaping in the executors 2020-04-17 16:46:43 -04:00
Louis Dionne ec442f0996 [libc++] run.py: Create directory hierarchy if it does not exist
This is useful when replaying tests after the fact and the directories
don't exist anymore.
2020-04-14 16:20:58 -04:00
Louis Dionne 3fefda6e57 [libc++] Run tests in a directory related to %t instead of /tmp
Instead of creating a temporary directory inside /tmp and running the
tests there, use a directory name based on LIT's %t substitution. This
has the benefit of not hitting /tmp so much (which is slow on some
filesystems). It also has the benefit that `ninja -C build clean` will
automatically remove the artifacts even if a test somehow failed to
remove its temporary directory (I've seen this happen when CTRL-C is
received).
2020-04-07 16:09:52 -04:00
Louis Dionne ceb58ad61d [libc++] Lit: Add default values for most arguments of test executors 2020-04-03 17:52:41 -04:00
Louis Dionne ff09135fc2 [libc++] Execute tests from the Lit execution root instead of the test tree
Instead of executing tests from within the libc++ test suite, we execute
them from the Lit execution directory. However, since some tests have
file dependencies, we must copy those dependencies to the execution
directory where they are executed.

This has the major benefit that if a test modifies a file (whether it
is wanted or not), other tests will not see those modifications. This
is good because current tests assume that input data is never modified,
however this could be an incorrect assumption if some test does not
behave properly.
2020-04-01 22:17:03 -04:00
Louis Dionne 34756a1c70 [libc++] Execute tests using an external shell
This makes it closer to how one would run the tests by hand, and it is
also closer to how the SSHExecutor runs the tests remotely. It also
allows using shell builtins in .sh.cpp tests when using %{exec}.
2020-03-31 11:31:39 -04:00
Louis Dionne 0feaf22c8a [libc++] Properly handle environment variables with '=' in them 2020-03-20 19:29:01 -04:00
Louis Dionne e22fe98d05 [libc++] Make the %run substitution closer to how .pass.cpp tests are executed
Before this patch, the %run substitution did not contain the same
environment variables as normal `pass.cpp` tests. It also didn't
have the right working directory and the script wasn't aware of
potential file dependencies.

With this change, the combination of %build and %run in a .sh.cpp script
should match how pass.cpp tests are actually executed much more closely.
2020-03-20 18:52:14 -04:00
Vedant Kumar 1261f1b980 [libcxx] Codesign test executables if necessary
If LLVM_CODESIGNING_IDENTITY is set, test executables need to be
codesigned.

Differential Revision: https://reviews.llvm.org/D66496

llvm-svn: 371126
2019-09-05 21:24:23 +00:00