Commit Graph

33 Commits

Author SHA1 Message Date
Ramon Asuncion
df96bda8fc [Test][Driver] Use xargs instead of command substitution 2025-10-15 11:57:38 -07:00
Ramon Asuncion
29677e3881 [Test][Driver] Use -tools-directory flag in filelists test
Replace env PATH manipulation with Swift driver's -tools-directory flag
to specify location of fake linker.

This seems to work with lit's internal shell, though I'm not 100% certain
it's the right approach.
2025-10-15 11:57:38 -07:00
Ramon Asuncion
c0fc417d66 [Test][Driver] Remove subshells from filelists test
Replace (cd %t && ...) with cd %t && ...
2025-10-15 11:57:30 -07:00
Evan Wilde
e5364fda0d FreeBSD: Disable driver/filelists.swift test
This test is flaky and creates noise. The compiler is occasionally
killed for some reason.

rdar://159456203
2025-09-03 09:43:27 -07:00
Ben Barham
0c7e3520ae [Test] Better workaround for filelists.swift
bdf60152f0 added some extra padding to
forFilelistCapture to avoid it being exactly 4096 bytes, triggering a
tail bug. Rather than do that, just run the sed's first so that the
input is quite small (definitely under 4096 bytes).

Resolves rdar://105395733.
2023-02-15 09:43:38 -08:00
Ben Barham
bdf60152f0 [Test] Add a hack to prevent a very odd tail bug
`test/Driver/filelists.swift` writes out the swift driver jobs to a file
called `%t/forFilelistCapture`. We then `tail -2 | head -1` that file to
get the first line, run some seds, and expect that to the output file
list (eg. from the swift-frontend command). Unfortunately if that file
happens to end up being 4096 in length, `tail` skips the first line and
thus the seds run on *second* line. That produces `/usr/bin/ld` instead,
which obviously doesn't contain the output files!

Add a comment to the end of the file so that it's unlikely to be 4096
in length. Technically we could still hit it if we removed a bunch of
arguments, but this is fine until that bug is fixed.
2022-06-29 15:08:29 -07:00
Ben Barham
c163e0fe5e [Tests] Make OS features consistent
lit.py currently allows any substring of `target_triple` to be used as a
feature in REQUIRES/UNSUPPORTED/XFAIL. This results in various forms of
the OS spread across the tests and is also somewhat confusing since they
aren't actually listed in the available features.

Modify all OS-related features to use the `OS=` version that Swift adds
instead. We can later remove `config.target_triple` so that these don't
the non-OS versions don't work in the first place.
2022-05-20 19:51:23 -07:00
QuietMisdreavus
419483863f Revert "[Driver][Frontend] add the symbol graph dir to the supplementary file map" 2021-04-22 12:20:14 -06:00
Victoria Mitchell
89a8151532 make Driver/filelists.swift resistant to warning output 2021-03-24 16:50:30 -05:00
Victoria Mitchell
97a4cba250 add the symbol graph dir to the supplementary file map
rdar://75582169
2021-03-24 09:44:23 -05:00
Yuta Saito
d6cddaabb5 [LTO] Support LLVM LTO for driver
This commit adds LTO support for handling linker options and LLVM BC
emission. Even for ELF, swift-autolink-extract is unnecessary because
linker options are embeded in LLVM BC content when LTO.
2020-07-31 10:17:59 +09:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Saleem Abdulrasool
d0203fec75 tests: avoid the not env pattern
The `not env` pattern will result in negating the results of `env`, not
the results of the inferior command.  This is dependent on the
implementation of the shell and env.  Use the more portable form.
2020-01-14 08:13:39 -08:00
Xi Ge
6ec4fc8ade test: update driver tests 2019-09-24 13:52:17 -07:00
David Zarzycki
d2c5597707 [Tests] Stabilize output order maps against incidental changes
The output file map is created in DenseMap order, which is an unordered
and "unstable" collection type.
2019-03-18 07:22:23 -04:00
Jason Mittertreiner
ac0d9ef31a Fixed Driver Dependency Tests on Windows
All Driver/Dependency Tests now pass on Windows!
2019-02-21 11:19:57 -08:00
Jason Mittertreiner
4e0b092fbe Fixing Driver tests on Windows (#20209) 2018-12-10 18:27:37 -08:00
Vinicius Vendramini
39d3963131 Fix broken tests
- Many tests got broken because of two things:
  - AST dump now outputs to stdout, but many tests expected stderr. This was a straightforward fix.
  - Many tests call swift with specific parameters; specifically, many call `swift frontend` directly. This makes them go through the compiler in unexpected ways, and specifically it makes them not have primary files, which breaks the new AST dump implementation. This commit adds the old implementation as a fallback for those cases, except it dumps to `stdout` to maintain some consistence.

Finally, the `/test/Driver/filelists.swift` failed for unknown reasons. It seems its output now had some lines out of order, and fixing the order made the test pass. However, as the reasons why it failed are unknown, this fix might not have been a good idea. Corrections are welcome.
2018-11-14 13:38:01 -02:00
Nathan Hawes
0a4204e99f [Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
When generating a compiler invocation in driver::createCompilerInvocation()
we end up using filelists if the number of inputs is > 128 (to work around
command line arg limits). We never actually write them out though, and so
fail when parsing the frontend arguments that reference them.

As this function is called frequently by SourceKit and command line limits
aren't a concern here, this patch makes the 128 threshold value configurable
via a new -driver-filelist-threshold option. This is set to its maximum value
in driver::createCompilerInvocation() to ensure filelists aren't used. This
new option makes the existing -driver-use-filelists (that forces filelists to
be used) redundant as it's now equivalent to -driver-filelist-threshold=0.

Resolves rdar://problem/38231888
2018-04-12 05:24:03 -07:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00
Brian Gesiak
0f523ec049 [Driver] Quote env to support paths with spaces
When a user's PATH includes spaces, tests in `test/Driver/filelists.swift`
would fail. Quoting the PATH variable fixes this issue.
2017-11-13 13:27:15 -05:00
Dmitri Gribenko
984210aa53 tests: replace '// RUN: rm -rf' '// RUN: mkdir' pairs with '%empty-directory(...)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Jordan Rose
a875d8c7c7 [Driver] Preserve filelists when a subprocess crashes. (#9849)
This should make it easier to rerun crashed jobs that use filelists;
previously you'd have to run the top-level driver command again with
-save-temps. I didn't want to save /all/ temporary files because that
often includes things like .o files, which could fill up your disk
pretty quickly. But we can always tweak this later.
2017-05-22 17:14:20 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Jordan Rose
839dfc05d3 [test] Tighten up test/Driver/filelists.swift.
- Stronger CHECK lines.
- Don't try to link when there's a fake frontend.
- Give the fake 'ld' an explicit .py suffix, and use a symlink to access it, which
  uncovered the first two problems.
2016-02-11 20:18:15 -08:00
Jordan Rose
9cb775a1e0 [test] Add explicit targets to Driver/filelists.swift.
These checks depend on Darwin-style linker invocations.
2016-01-15 10:14:00 -08:00
Jordan Rose
bbc14afd04 [Driver] Write per-job filelists even under -save-temps.
Same as the previous commit; here's a test case that triggers it.

Last bit of https://bugs.swift.org/browse/SR-280.
2016-01-13 18:41:05 -08:00
Jordan Rose
ce34ed593c [Driver] Use filelists for the *output* of a threaded WMO build.
This is only the driver side of the work; the frontend doesn't understand
this new -output-filelist option yet. Next commit.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
062713d600 [Driver] Use -filelist for the merge-module step.
More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
6067120f81 [Driver] Emit filelists for Jobs that want them (inputs).
This is the other half of the previous commit: we can use -filelist for
linking on Darwin.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
fe00083eb1 [Driver] Actually write out the source file list file.
This is simply a newline-separated list of files, matching the format
from Darwin ld's -filelist option.

Part 2 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00