Skip to content

Commit c076b58

Browse files
committed
[embedded] When checking expected dependencies, use the .o file instea of linked result
1 parent 6e3c5a8 commit c076b58

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

test/embedded/dependencies.swift

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -enable-experimental-feature Embedded %s -c -o %t/a.o
3+
4+
// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt
5+
// RUN: %llvm-nm --undefined-only --format=just-symbols %t/a.o | sort | tee %t/actual-dependencies.txt
6+
7+
// Fail if there is any entry in actual-dependencies.txt that's not in allowed-dependencies.txt
8+
// RUN: test -z `comm -13 %t/allowed-dependencies.txt %t/actual-dependencies.txt`
9+
10+
// DEP: ___stack_chk_fail
11+
// DEP: ___stack_chk_guard
12+
// DEP: _free
13+
// DEP: _memset
14+
// DEP: _putchar
15+
// DEP: _posix_memalign
16+
317
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
418
// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
519
// RUN: %target-run %t/a.out | %FileCheck %s
620

7-
// backslash is not doing anything, just to make the grep not match its own line
8-
// RUN: grep DEP-%target-os %s | sed 's#// DEP-%target-os: ##' | sort > %t/expected-dependencies.txt
9-
// RUN: %llvm-nm --undefined-only --format=just-symbols %t/a.out | sort > %t/actual-dependencies.txt
10-
// RUN: diff -u %t/expected-dependencies.txt %t/actual-dependencies.txt
11-
12-
// DEP-macosx: ___stack_chk_fail
13-
// DEP-macosx: ___stack_chk_guard
14-
// DEP-macosx: _free
15-
// DEP-macosx: _posix_memalign
16-
// DEP-macosx: _printf
17-
// DEP-macosx: _putchar
18-
// DEP-macosx: dyld_stub_binder
19-
20-
// DEP-linux-gnu: __stack_chk_fail
21-
// DEP-linux-gnu: __stack_chk_guard
22-
// DEP-linux-gnu: free
23-
// DEP-linux-gnu: posix_memalign
24-
// DEP-linux-gnu: putchar
25-
2621
// REQUIRES: swift_in_compiler
2722
// REQUIRES: executable_test
2823
// REQUIRES: optimized_stdlib

0 commit comments

Comments
 (0)