Skip to content

Commit 8a6d28c

Browse files
committed
Fix the Rest of the Windows Driver Tests
1 parent 041eda1 commit 8a6d28c

15 files changed

+40
-27
lines changed

include/swift/Frontend/PrintingDiagnosticConsumer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "swift/AST/DiagnosticConsumer.h"
2323

2424
#include "llvm/Support/raw_ostream.h"
25+
#include "llvm/Support/Process.h"
2526

2627
namespace swift {
2728

@@ -42,6 +43,7 @@ class PrintingDiagnosticConsumer : public DiagnosticConsumer {
4243

4344
void forceColors() {
4445
ForceColors = true;
46+
llvm::sys::Process::UseANSIEscapeCodes(true);
4547
}
4648

4749
bool didErrorOccur() {

lib/ClangImporter/ClangImporter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ addCommonInvocationArguments(std::vector<std::string> &invocationArgStrs,
716716
invocationArgStrs.push_back(importerOpts.IndexStorePath);
717717
}
718718

719+
invocationArgStrs.push_back("-fansi-escape-codes");
720+
719721
for (auto extraArg : importerOpts.ExtraArgs) {
720722
invocationArgStrs.push_back(extraArg);
721723
}
@@ -876,7 +878,6 @@ ClangImporter::create(ASTContext &ctx,
876878
// Clang expects this to be like an actual command line. So we need to pass in
877879
// "clang" for argv[0]
878880
invocationArgStrs.push_back("clang");
879-
880881
switch (importerOpts.Mode) {
881882
case ClangImporterOptions::Modes::Normal:
882883
getNormalInvocationArguments(invocationArgStrs, ctx, importerOpts);

test/Driver/Inputs/crash-after-generating-pch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1111

1212
import os
13+
import platform
1314
import signal
1415
import sys
1516

1617
assert sys.argv[1] == '-frontend'
1718

1819
if '-emit-pch' not in sys.argv:
19-
os.kill(os.getpid(), signal.SIGKILL)
20+
if platform.system() == 'Windows':
21+
exit(-2)
22+
else:
23+
os.kill(os.getpid(), signal.SIGKILL)
2024

2125
outputFile = sys.argv[sys.argv.index('-o') + 1]
2226

test/Driver/batch_mode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Windows does not support batch-mode yet
2-
// XFAIL: win32
2+
// XFAIL: windows
33
//
44
// RUN: %empty-directory(%t)
55
// RUN: touch %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/file-04.swift %t/file-05.swift

test/Driver/batch_mode_aux_file_order.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Batch-mode is not supported on Windows yet
2-
// XFAIL: win32
2+
// XFAIL: windows
33
//
44
// When multiple additional-outputs on the same command-line are no longer
55
// supported (i.e. when we've moved to mandatory use of output file maps for

test/Driver/bridging-pch.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
// RUN: mkdir %t/tmp
2727
// RUN: env TMP="%t/tmp/" TMPDIR="%t/tmp/" not %target-build-swift -typecheck -import-objc-header %S/../Inputs/empty.h -driver-use-frontend-path "%{python};%S/Inputs/crash-after-generating-pch.py" -v %s
28-
// RUN: ls %/t/tmp/*.pch
28+
// RUN: ls %/t/tmp/ | grep .*pch
2929

3030
// Test persistent PCH
3131

@@ -49,19 +49,19 @@
4949

5050
// RUN: %target-build-swift -typecheck -driver-print-jobs -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch %s 2>&1 | %FileCheck %s -check-prefix=PERSISTENT-YESPCHJOB
5151
// PERSISTENT-YESPCHJOB: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -emit-pch -pch-output-dir {{.*}}/pch
52-
// PERSISTENT-YESPCHJOB: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -import-objc-header {{.*}}bridging-header.h -pch-output-dir {{.*}}/pch -pch-disable-validation
52+
// PERSISTENT-YESPCHJOB: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -import-objc-header {{.*}}bridging-header.h{{"?}} -pch-output-dir {{.*}}/pch{{"?}} -pch-disable-validation
5353

5454
// RUN: %target-build-swift -typecheck -driver-print-jobs -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch -serialize-diagnostics %s 2>&1 | %FileCheck %s -check-prefix=PERSISTENT-YESPCHJOB-DIAG1
55-
// PERSISTENT-YESPCHJOB-DIAG1: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -serialize-diagnostics-path {{.*}}bridging-header-{{.*}}.dia {{.*}} -emit-pch -pch-output-dir {{.*}}/pch
55+
// PERSISTENT-YESPCHJOB-DIAG1: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -serialize-diagnostics-path {{.*}}bridging-header-{{.*}}.dia{{"?}} {{.*}} -emit-pch -pch-output-dir {{.*}}/pch
5656

5757
// RUN: %target-build-swift -typecheck -driver-print-jobs -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch-out-dir -serialize-diagnostics %s -emit-module -emit-module-path /module-path-dir 2>&1 | %FileCheck %s -check-prefix=PERSISTENT-YESPCHJOB-DIAG2
58-
// PERSISTENT-YESPCHJOB-DIAG2: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -serialize-diagnostics-path {{.*}}/pch-out-dir/bridging-header-{{.*}}.dia {{.*}} -emit-pch -pch-output-dir {{.*}}/pch-out-dir
58+
// PERSISTENT-YESPCHJOB-DIAG2: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -serialize-diagnostics-path {{.*}}/pch-out-dir{{/|\\\\}}bridging-header-{{.*}}.dia{{"?}} {{.*}} -emit-pch -pch-output-dir {{.*}}/pch-out-dir
5959

6060
// RUN: %target-build-swift -typecheck -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch -parseable-output -driver-skip-execution %s 2>&1 | %FileCheck %s -check-prefix=PERSISTENT-OUTPUT
6161
// PERSISTENT-OUTPUT-NOT: "outputs": [
6262

6363
// RUN: %target-build-swift -typecheck -driver-print-jobs -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch -whole-module-optimization %s 2>&1 | %FileCheck %s -check-prefix=PERSISTENT-WMO-YESPCHJOB --implicit-check-not pch-disable-validation
64-
// PERSISTENT-WMO-YESPCHJOB: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -import-objc-header {{.*}}bridging-header.h -pch-output-dir {{.*}}/pch
64+
// PERSISTENT-WMO-YESPCHJOB: {{.*}}swift{{c?(\.EXE)?"?}} -frontend {{.*}} -import-objc-header {{.*}}bridging-header.h{{"?}} -pch-output-dir {{.*}}/pch
6565

6666
// RUN: %target-build-swift -typecheck -disable-bridging-pch -driver-print-jobs -import-objc-header %/S/Inputs/bridging-header.h -pch-output-dir %t/pch %/s 2>&1 | %FileCheck %s -check-prefix=NOPCHJOB
6767
// RUN: %target-build-swift -typecheck -incremental -enable-bridging-pch -output-file-map %t.json -import-objc-header %S/Inputs/bridging-header.h -pch-output-dir %t/pch %s

test/Driver/linker-clang_rt.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
// CHECK: {{(bin/)?}}ld{{"? }}
3333
// CHECK-NO-RUNTIME-NOT: libclang_rt
34-
// CHECK-MACOS-SAME: {{[^ ]+/lib/swift/clang/lib/darwin/libclang_rt.osx.a}}
35-
// CHECK-IOS-SAME: {{[^ ]+/lib/swift/clang/lib/darwin/libclang_rt.ios.a}}
36-
// CHECK-TVOS-SAME: {{[^ ]+/lib/swift/clang/lib/darwin/libclang_rt.tvos.a}}
37-
// CHECK-WATCHOS-SAME: {{[^ ]+/lib/swift/clang/lib/darwin/libclang_rt.watchos.a}}
34+
// CHECK-MACOS-SAME: {{[^ ]+(/|\\\\)lib(/|\\\\)swift(/|\\\\)clang(/|\\\\)lib(/|\\\\)darwin(/|\\\\)libclang_rt.osx.a}}
35+
// CHECK-IOS-SAME: {{[^ ]+(/|\\\\)lib(/|\\\\)swift(/|\\\\)clang(/|\\\\)lib(/|\\\\)darwin(/|\\\\)libclang_rt.ios.a}}
36+
// CHECK-TVOS-SAME: {{[^ ]+(/|\\\\)lib(/|\\\\)swift(/|\\\\)clang(/|\\\\)lib(/|\\\\)darwin(/|\\\\)libclang_rt.tvos.a}}
37+
// CHECK-WATCHOS-SAME: {{[^ ]+(/|\\\\)lib(/|\\\\)swift(/|\\\\)clang(/|\\\\)lib(/|\\\\)darwin(/|\\\\)libclang_rt.watchos.a}}
3838
// CHECK-SAME: -o {{[^ ]+}}

test/Driver/linker.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: win32
1+
// Must be able to run xcrun-return-self.sh
2+
// REQUIRES: shell
23
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s 2>&1 > %t.simple.txt
34
// RUN: %FileCheck %s < %t.simple.txt
45
// RUN: %FileCheck -check-prefix SIMPLE %s < %t.simple.txt

test/Driver/multi-threaded.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@
2525
// MODULE-DAG: -num-threads 4
2626
// MODULE-DAG: {{[^ ]*[/\\]}}Inputs{{/|\\\\}}main.swift{{"?}} {{[^ ]*[/\\]}}multi-threaded.swift
2727
// MODULE-DAG: -o test.swiftmodule
28-
// MODULE-NOT: ld
28+
// MODULE-NOT: {{ld|clang\+\+}}
2929

3030
// ASSEMBLY: -frontend
3131
// ASSEMBLY-DAG: -num-threads 4
3232
// ASSEMBLY-DAG: {{[^ ]*[/\\]}}Inputs{{/|\\\\}}main.swift{{"?}} {{[^ ]*[/\\]}}multi-threaded.swift
3333
// ASSEMBLY-DAG: -o /build/main.s -o /build/multi-threaded.s
34-
// ASSEMBLY-NOT: ld
34+
// ASSEMBLY-NOT: {{ld|clang\+\+}}
3535

3636
// OBJECT: -frontend
3737
// OBJECT-DAG: -num-threads 4
3838
// OBJECT-DAG: {{[^ ]*[/\\]}}Inputs{{/|\\\\}}main.swift{{"?}} {{[^ ]*[/\\]}}multi-threaded.swift
3939
// OBJECT-DAG: -o main.o -o multi-threaded.o
40-
// OBJECT-NOT: ld
40+
// OBJECT-NOT: {{ld|clang\+\+}}
4141

4242
// BITCODE: -frontend
4343
// BITCODE-DAG: -num-threads 4
4444
// BITCODE-DAG: {{[^ ]*[/\\]}}Inputs{{/|\\\\}}main.swift{{"?}} {{[^ ]*[/\\]}}multi-threaded.swift
4545
// BITCODE-DAG: -o {{.*[/\\]}}main.bc -o {{.*[/\\]}}multi-threaded.bc
4646
// BITCODE-DAG: -frontend -c -primary-file {{.*[/\\]}}main.bc {{.*}} -o {{[^ ]*}}main.o
4747
// BITCODE-DAG: -frontend -c -primary-file {{.*[/\\]}}multi-threaded.bc {{.*}} -o {{[^ ]*}}multi-threaded.o
48-
// BITCODE-NOT: ld
48+
// BITCODE-NOT: {{ld|clang\+\+}}
4949

5050
// PARSEABLE: "outputs": [
5151
// PARSEABLE: "path": "main.o"
@@ -55,7 +55,7 @@
5555
// EXEC-DAG: -num-threads 4
5656
// EXEC-DAG: {{[^ ]*[/\\]}}Inputs{{/|\\\\}}main.swift{{"?}} {{[^ ]*[/\\]}}multi-threaded.swift
5757
// EXEC-DAG: -o {{.*te?mp.*[/\\]}}main{{[^ ]*}}.o{{"?}} -o {{.*te?mp.*[/\\]}}multi-threaded{{[^ ]*}}.o
58-
// EXEC: ld
58+
// EXEC: {{ld|clang\+\+}}
5959
// EXEC: {{.*te?mp.*[/\\]}}main{{[^ ]*}}.o{{"?}} {{.*te?mp.*[/\\]}}multi-threaded{{[^ ]*}}.o
6060

6161
// DEPENDENCIES-DAG: {{.*}}multi-threaded.o : {{.*[/\\]}}multi-threaded.swift {{.*[/\\]}}Inputs{{[/\\]}}main.swift

test/Driver/options-repl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// REPL_NO_FILES: REPL mode requires no input files
77

8-
// RUN: rm -rf %t
8+
// RUN: %empty-directory(%t)
99
// RUN: mkdir -p %t/usr/bin
1010
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
1111

test/Driver/options.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// DEFAULT_EXEC_ERR: error: no input files
3636
// RUN: %swiftc_driver %s -### 2>&1 | %FileCheck -check-prefix=DEFAULT_EXEC %s
3737
// DEFAULT_EXEC: -c
38-
// DEFAULT_EXEC: ld
38+
// DEFAULT_EXEC: {{ld|clang\+\+}}
3939

4040
// RUN: %swift_driver -repl -### 2>&1 | %FileCheck -check-prefix=REPL %s
4141
// REPL: warning: unnecessary option '-repl'

test/Driver/pipe_round_robin.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Windows doesn't track/use read() and poll()
2+
// UNSUPPORTED: windows
13
// RUN: %empty-directory(%t/manyfuncs)
24
// RUN: %empty-directory(%t/stats)
35
//

test/Driver/sdk-apple.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// XFAIL: freebsd, linux, win32
1+
// XFAIL: freebsd, linux, windows
22

33
// Test SDK detection for immediate mode.
44
// RUN: %empty-directory(%t)

test/Driver/subcommands.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: shell
12
// Check that 'swift' and 'swift repl' invoke the REPL.
23

34
// RUN: rm -rf %t.dir

test/lit.cfg

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,11 +1372,13 @@ config.substitutions.append(('%llvm-profdata', config.llvm_profdata))
13721372
config.substitutions.append(('%llvm-cov', config.llvm_cov))
13731373

13741374
config.substitutions.append(('%FileCheck',
1375-
'%r %r --sanitize BUILD_DIR=%r --sanitize SOURCE_DIR=%r --use-filecheck %r' % (sys.executable,
1376-
config.PathSanitizingFileCheck,
1377-
swift_obj_root,
1378-
config.swift_src_root,
1379-
config.filecheck)))
1375+
'%r %r --sanitize BUILD_DIR=%r --sanitize SOURCE_DIR=%r --use-filecheck %r' % (
1376+
sys.executable,
1377+
config.PathSanitizingFileCheck,
1378+
# Match lit/python, which, on Windows, normalizes path case (lowercases)
1379+
swift_obj_root.lower() if kIsWindows else swift_obj_root,
1380+
config.swift_src_root,
1381+
config.filecheck)))
13801382
config.substitutions.append(('%raw-FileCheck', pipes.quote(config.filecheck)))
13811383

13821384
# If static stdlib is present, enable static stdlib tests

0 commit comments

Comments
 (0)