Need some help understanding test behavior.

Hi,

I am trying to understand behavior of Swift test case
Sanitizers/tsan.swift. When I run Swift test suite, this test case
generates corresponding test script as follows:

set -o pipefail;{
/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swiftc
-target powerpc64le-unknown-linux-gnu -module-cache-path
'/tmp/swift-testsuite-clang-module-cacheGEeVqc'
/root/swift-source/swift/test/Sanitizers/tsan.swift -target
powerpc64le-unknown-linux-gnu -g -sanitize=thread -o
/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/test-linux-powerpc64le/Sanitizers/Output/tsan.swift.tmp_tsan-binary;
} &&
{ not env TSAN_OPTIONS="abort_on_error=0"
/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/test-linux-powerpc64le/Sanitizers/Output/tsan.swift.tmp_tsan-binary
2>&1 | /root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize
'BUILD_DIR=/root/swift-source/buildbot_incremental/swift-linux-powerpc64le'
--sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck
'/root/swift-source/buildbot_incremental/llvm-linux-powerpc64le/./bin/FileCheck'
/root/swift-source/swift/test/Sanitizers/tsan.swift; }

The first line in this script is failing (actually crashing) on my machine
and I am trying to analyze it. What I have seen is this first line
generates following command:

/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swift
-frontend -c -primary-file
/root/swift-source/swift/test/Sanitizers/tsan.swift -target
powerpc64le-unknown-linux-gnu -disable-objc-interop -g -module-cache-path
/tmp/swift-testsuite-clang-module-cacheGEeVqc -sanitize=thread
-emit-module-doc-path /tmp/tsan-d095e5.swiftdoc -color-diagnostics
-module-name main -emit-module-path /tmp/tsan-d095e5.swiftmodule -o
/tmp/tsan-d095e5.o

This crashes bitterly. Having extremely new with Swift, I was trying to toy
with this command and found that if I omit "-frontend -c -primary-file"
arguments and keep everything else same, it just works. So effectively I am
using this "modified" command:

/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swift
/root/swift-source/swift/test/Sanitizers/tsan.swift -target
powerpc64le-unknown-linux-gnu -disable-objc-interop -g -module-cache-path
/tmp/swift-testsuite-clang-module-cacheGEeVqc -sanitize=thread
-emit-module-doc-path /tmp/tsan-d095e5.swiftdoc -color-diagnostics
-module-name main -emit-module-path /tmp/tsan-d095e5.swiftmodule -o
/tmp/tsan-d095e5.o

As per my understanding so far, -frontend -c is invoking "C" frontend, I
don't know much about the "-primary_file". By removing "-frontend -c" I am
probably suppressing invocation of "C" frontend. But they what is used to
complete the execution?

I would like to know if tweaking makes any sense first of all, and if so,
how can I go about debugging this issue?

Thanks,
Atul.

This sounds like a question for the swift-dev list, directed toward whomever has been working on linux/powerpc support...

Hi,

I am trying to understand behavior of Swift test case Sanitizers/tsan.swift. When I run Swift test suite, this test case generates corresponding test script as follows:

set -o pipefail;{ /root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swiftc -target powerpc64le-unknown-linux-gnu -module-cache-path '/tmp/swift-testsuite-clang-module-cacheGEeVqc' /root/swift-source/swift/test/Sanitizers/tsan.swift -target powerpc64le-unknown-linux-gnu -g -sanitize=thread -o /root/swift-source/buildbot_incremental/swift-linux-powerpc64le/test-linux-powerpc64le/Sanitizers/Output/tsan.swift.tmp_tsan-binary; } &&
{ not env TSAN_OPTIONS="abort_on_error=0" /root/swift-source/buildbot_incremental/swift-linux-powerpc64le/test-linux-powerpc64le/Sanitizers/Output/tsan.swift.tmp_tsan-binary 2>&1 | /root/swift-source/swift/utils/PathSanitizingFileCheck --sanitize 'BUILD_DIR=/root/swift-source/buildbot_incremental/swift-linux-powerpc64le' --sanitize 'SOURCE_DIR=/root/swift-source/swift' --use-filecheck '/root/swift-source/buildbot_incremental/llvm-linux-powerpc64le/./bin/FileCheck' /root/swift-source/swift/test/Sanitizers/tsan.swift; }

The first line in this script is failing (actually crashing) on my machine and I am trying to analyze it. What I have seen is this first line generates following command:

/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swift -frontend -c -primary-file /root/swift-source/swift/test/Sanitizers/tsan.swift -target powerpc64le-unknown-linux-gnu -disable-objc-interop -g -module-cache-path /tmp/swift-testsuite-clang-module-cacheGEeVqc -sanitize=thread -emit-module-doc-path /tmp/tsan-d095e5.swiftdoc -color-diagnostics -module-name main -emit-module-path /tmp/tsan-d095e5.swiftmodule -o /tmp/tsan-d095e5.o

This crashes bitterly. Having extremely new with Swift, I was trying to toy with this command and found that if I omit "-frontend -c -primary-file" arguments and keep everything else same, it just works. So effectively I am using this "modified" command:

If you want to see the full command line from a “swiftc” invocation, append “-###” to the command line.

I don’t know what effect -primary-file would have when compiling a single source.

/root/swift-source/buildbot_incremental/swift-linux-powerpc64le/bin/swift /root/swift-source/swift/test/Sanitizers/tsan.swift -target powerpc64le-unknown-linux-gnu -disable-objc-interop -g -module-cache-path /tmp/swift-testsuite-clang-module-cacheGEeVqc -sanitize=thread -emit-module-doc-path /tmp/tsan-d095e5.swiftdoc -color-diagnostics -module-name main -emit-module-path /tmp/tsan-d095e5.swiftmodule -o /tmp/tsan-d095e5.o

As per my understanding so far, -frontend -c is invoking "C" frontend, I don't know much about the "-primary_file". By removing "-frontend -c" I am probably suppressing invocation of "C" frontend. But they what is used to complete the execution?

“-c” just means “compile" down to a .o file. The language will be inferred from the file extension I believe.

I would like to know if tweaking makes any sense first of all, and if so, how can I go about debugging this issue?

I have no idea what could be going wrong since I don’t work on tsan or linux, but I suspect that the compile step is succeeding and the link step is failing (-### will also show you the linker command line). The linker should tell you what symbol is missing. Then you can compare the symbols to those the x86 build provides and find out why they’re not available on powerpc.

-Andy

···

On Dec 14, 2017, at 3:25 AM, Atul Sowani via swift-users <swift-users@swift.org> wrote:

Thanks,
Atul.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users