diff --git a/test/embedded/dependencies-print.swift b/test/embedded/dependencies-print.swift index adaf41c2a6b5..31064f38ff14 100644 --- a/test/embedded/dependencies-print.swift +++ b/test/embedded/dependencies-print.swift @@ -1,16 +1,36 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -enable-experimental-feature Embedded -no-allocations %s -c -o %t/a.o - -// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt - -// Linux/ELF doesn't use the "_" prefix in symbol mangling. -// RUN: if [ %target-os == "linux-gnu" ]; then sed -E -i -e 's/^_(.*)$/\1/' %t/allowed-dependencies.txt; fi +// RUN: split-file %s %t +// RUN: %target-swift-frontend -enable-experimental-feature Embedded -no-allocations %t/test.swift -c -o %t/a.o // RUN: %llvm-nm --undefined-only --format=just-symbols %t/a.o | sort | tee %t/actual-dependencies.txt -// Fail if there is any entry in actual-dependencies.txt that's not in allowed-dependencies.txt -// RUN: test -z "`comm -13 %t/allowed-dependencies.txt %t/actual-dependencies.txt`" - +// RUN: %if OS=linux-gnu %{ sort %t/allowed-dependencies_linux.txt -o %t/allowed-dependencies_linux.txt %} +// RUN: %if OS=linux-gnu %{ comm -13 %t/allowed-dependencies_linux.txt %t/actual-dependencies.txt > %t/extra.txt %} +// RUN: %if OS=linux-gnu %{ test ! -s %t/extra.txt %} + +// RUN: %if OS=macosx %{ sort %t/allowed-dependencies_macos.txt -o %t/allowed-dependencies_macos.txt %} +// RUN: %if OS=macosx %{ comm -13 %t/allowed-dependencies_macos.txt %t/actual-dependencies.txt > %t/extra.txt %} +// RUN: %if OS=macosx %{ test ! -s %t/extra.txt %} + +//--- allowed-dependencies_macos.txt +___stack_chk_fail +___stack_chk_guard +___divti3 +___modti3 +_memmove +_memset +_putchar + +//--- allowed-dependencies_linux.txt +__stack_chk_fail +__stack_chk_guard +__divti3 +__modti3 +memmove +memset +putchar + +//--- test.swift // DEP: ___stack_chk_fail // DEP: ___stack_chk_guard // DEP: ___divti3