diff options
Diffstat (limited to 'test/xray/TestCases')
-rw-r--r-- | test/xray/TestCases/Posix/argv0-log-file-name.cc | 2 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/basic-filtering.cc | 4 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/clang-no-xray-instrument.cc | 11 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/fdr-mode.cc | 33 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/fdr-reinit.cc | 73 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/fdr-single-thread.cc | 12 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/fdr-thread-order.cc | 35 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/fork_basic_logging.cc | 21 | ||||
-rw-r--r-- | test/xray/TestCases/Posix/profiling-multi-threaded.cc | 2 |
9 files changed, 132 insertions, 61 deletions
diff --git a/test/xray/TestCases/Posix/argv0-log-file-name.cc b/test/xray/TestCases/Posix/argv0-log-file-name.cc index 2f9a234f80644..a2cb11b4d0d9f 100644 --- a/test/xray/TestCases/Posix/argv0-log-file-name.cc +++ b/test/xray/TestCases/Posix/argv0-log-file-name.cc @@ -4,7 +4,7 @@ // RUN: %clangxx_xray -std=c++11 %s -o %t // RUN: XRAY_OPTIONS="patch_premain=true xray_naive_log=true" %run %t > xray.log.file.name 2>&1 // RUN: ls | FileCheck xray.log.file.name -// RUN: rm xray-log.* xray.log.file.name +// RUN: rm xray-log.argv0-log-file-name.* xray.log.file.name // UNSUPPORTED: target-is-mips64,target-is-mips64el diff --git a/test/xray/TestCases/Posix/basic-filtering.cc b/test/xray/TestCases/Posix/basic-filtering.cc index db07ef510c5c7..3d4f4dda2d72d 100644 --- a/test/xray/TestCases/Posix/basic-filtering.cc +++ b/test/xray/TestCases/Posix/basic-filtering.cc @@ -57,5 +57,5 @@ always_shows() { // TRACE-NOT: - { type: 0, func-id: {{.*}}, function: {{.*filtered.*}}, {{.*}} } // TRACE-NOT: - { type: 0, func-id: {{.*}}, function: {{.*beyond_stack.*}}, {{.*}} } -// TRACE-DAG: - { type: 0, func-id: [[FID:[0-9]+]], function: {{.*always_shows.*}}, cpu: {{.*}}, thread: {{.*}}, kind: function-enter, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FID]], function: {{.*always_shows.*}}, cpu: {{.*}}, thread: {{.*}}, kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FID:[0-9]+]], function: {{.*always_shows.*}}, cpu: {{.*}}, thread: {{.*}}, kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FID]], function: {{.*always_shows.*}}, cpu: {{.*}}, thread: {{.*}}, kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } diff --git a/test/xray/TestCases/Posix/clang-no-xray-instrument.cc b/test/xray/TestCases/Posix/clang-no-xray-instrument.cc new file mode 100644 index 0000000000000..c2444b18ab6ed --- /dev/null +++ b/test/xray/TestCases/Posix/clang-no-xray-instrument.cc @@ -0,0 +1,11 @@ +// Test that we cannot actually find XRay instrumentation when we build with +// -fno-xray-instrument but have code that's marked as 'xray_always_instrument'. +// +// RUN: %clangxx -fno-xray-instrument -c %s -o %t.o +// RUN: not %llvm_xray extract -symbolize %t.o 2>&1 | FileCheck %s +// REQUIRES: x86_64-target-arch +// REQUIRES: built-in-llvm-tree + +// CHECK: llvm-xray: Cannot extract instrumentation map +// CHECK-NOT: {{.*always_instrumented.*}} +[[clang::xray_always_instrument]] int always_instrumented() { return 42; } diff --git a/test/xray/TestCases/Posix/fdr-mode.cc b/test/xray/TestCases/Posix/fdr-mode.cc index b12d97c0005a7..8b9cb2bbfd530 100644 --- a/test/xray/TestCases/Posix/fdr-mode.cc +++ b/test/xray/TestCases/Posix/fdr-mode.cc @@ -42,7 +42,6 @@ thread_local uint64_t var = 0; void __attribute__((noinline)) fArg(int) { } int main(int argc, char *argv[]) { - using namespace __xray; std::cout << "Logging before init." << std::endl; // CHECK: Logging before init. assert(__xray_log_select_mode("xray-fdr") == @@ -81,32 +80,32 @@ int main(int argc, char *argv[]) { } // Check that we're able to see two threads, each entering and exiting fA(). -// TRACE-DAG: - { type: 0, func-id: [[FIDA:[0-9]+]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FIDA:[0-9]+]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDA]], function: {{.*fA.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } // // Do the same as above for fC() -// TRACE-DAG: - { type: 0, func-id: [[FIDC:[0-9]+]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FIDC:[0-9]+]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDC]], function: {{.*fC.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } // Do the same as above for fB() -// TRACE-DAG: - { type: 0, func-id: [[FIDB:[0-9]+]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FIDB:[0-9]+]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE: - { type: 0, func-id: [[FIDB]], function: {{.*fB.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } -// TRACE-DAG: - { type: 0, func-id: [[FIDARG:[0-9]+]], function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-enter-arg, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FIDARG]], function: 'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-exit, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FIDARG:[0-9]+]], function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-enter-arg, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FIDARG]], function: 'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-exit, tsc: {{[0-9]+}}, data: '' } // Assert that when unwriting is enabled with a high threshold time, all the function records are erased. A CPU switch could erroneously fail this test, but // is unlikely given the test program. // Even with a high threshold, arg1 logging is never unwritten. // UNWRITE: header: // UNWRITE: records: -// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG:[0-9]+]], function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter-arg, tsc: {{[0-9]+}} } -// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG]], function: 'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-exit, tsc: {{[0-9]+}} } +// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG:[0-9]+]], function: 'fArg(int)', args: [ 1 ], cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter-arg, tsc: {{[0-9]+}}, data: '' } +// UNWRITE-NEXT: - { type: 0, func-id: [[FIDARG]], function: 'fArg(int)', cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: function-exit, tsc: {{[0-9]+}}, data: '' } // UNWRITE-NOT: function-enter // UNWRITE-NOT: function-{{exit|tail-exit}} diff --git a/test/xray/TestCases/Posix/fdr-reinit.cc b/test/xray/TestCases/Posix/fdr-reinit.cc new file mode 100644 index 0000000000000..dc9888d6e48aa --- /dev/null +++ b/test/xray/TestCases/Posix/fdr-reinit.cc @@ -0,0 +1,73 @@ +// RUN: %clangxx_xray -g -std=c++11 %s -o %t +// RUN: rm xray-log.fdr-reinit* || true +// RUN: XRAY_OPTIONS="verbosity=1" %run %t +// RUN: rm xray-log.fdr-reinit* || true +#include "xray/xray_log_interface.h" +#include <atomic> +#include <cassert> +#include <cstddef> +#include <thread> + +volatile uint64_t var = 0; + +std::atomic_flag keep_going = ATOMIC_FLAG_INIT; + +[[clang::xray_always_instrument]] void __attribute__((noinline)) func() { + ++var; +} + +int main(int argc, char *argv[]) { + // Start a thread that will just keep calling the function, to spam calls to + // the function call handler. + keep_going.test_and_set(std::memory_order_acquire); + std::thread t([] { + while (keep_going.test_and_set(std::memory_order_acquire)) + func(); + }); + + static constexpr char kConfig[] = + "buffer_size=1024:buffer_max=10:no_file_flush=true"; + + // Then we initialize the FDR mode implementation. + assert(__xray_log_select_mode("xray-fdr") == + XRayLogRegisterStatus::XRAY_REGISTRATION_OK); + auto init_status = __xray_log_init_mode("xray-fdr", kConfig); + assert(init_status == XRayLogInitStatus::XRAY_LOG_INITIALIZED); + + // Now we patch the instrumentation points. + __xray_patch(); + + // Spin for a bit, calling func() enough times. + for (auto i = 0; i < 1 << 20; ++i) + func(); + + // Then immediately finalize the implementation. + auto finalize_status = __xray_log_finalize(); + assert(finalize_status == XRayLogInitStatus::XRAY_LOG_FINALIZED); + + // Once we're here, we should then flush. + auto flush_status = __xray_log_flushLog(); + assert(flush_status == XRayLogFlushStatus::XRAY_LOG_FLUSHED); + + // Without doing anything else, we should re-initialize. + init_status = __xray_log_init_mode("xray-fdr", kConfig); + assert(init_status == XRayLogInitStatus::XRAY_LOG_INITIALIZED); + + // Then we spin for a bit again calling func() enough times. + for (auto i = 0; i < 1 << 20; ++i) + func(); + + // Then immediately finalize the implementation. + finalize_status = __xray_log_finalize(); + assert(finalize_status == XRayLogInitStatus::XRAY_LOG_FINALIZED); + + // Once we're here, we should then flush. + flush_status = __xray_log_flushLog(); + assert(flush_status == XRayLogFlushStatus::XRAY_LOG_FLUSHED); + + // Finally, we should signal the sibling thread to stop. + keep_going.clear(std::memory_order_release); + + // Then join. + t.join(); +} diff --git a/test/xray/TestCases/Posix/fdr-single-thread.cc b/test/xray/TestCases/Posix/fdr-single-thread.cc index 480502b0a60f3..accc5925c6820 100644 --- a/test/xray/TestCases/Posix/fdr-single-thread.cc +++ b/test/xray/TestCases/Posix/fdr-single-thread.cc @@ -13,16 +13,10 @@ #include "xray/xray_log_interface.h" #include <cassert> -constexpr auto kBufferSize = 16384; -constexpr auto kBufferMax = 10; - [[clang::xray_always_instrument]] void __attribute__((noinline)) fn() { } int main(int argc, char *argv[]) { - using namespace __xray; - FDRLoggingOptions Opts; - - auto status = __xray_log_init(kBufferSize, kBufferMax, &Opts, sizeof(Opts)); + auto status = __xray_log_init_mode("xray-fdr", ""); assert(status == XRayLogInitStatus::XRAY_LOG_INITIALIZED); __xray_patch(); @@ -34,5 +28,5 @@ int main(int argc, char *argv[]) { } // CHECK: records: -// CHECK-NEXT: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*fn.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}} } -// CHECK-NEXT: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*fn.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-exit, tsc: {{[0-9]+}} } +// CHECK-NEXT: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*fn.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// CHECK-NEXT: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*fn.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-exit, tsc: {{[0-9]+}}, data: '' } diff --git a/test/xray/TestCases/Posix/fdr-thread-order.cc b/test/xray/TestCases/Posix/fdr-thread-order.cc index 1d6b01759f14d..eb405967a0d80 100644 --- a/test/xray/TestCases/Posix/fdr-thread-order.cc +++ b/test/xray/TestCases/Posix/fdr-thread-order.cc @@ -1,15 +1,12 @@ -// RUN: %clangxx_xray -g -std=c++11 %s -o %t -// RUN: rm fdr-thread-order.* || true -// RUN: XRAY_OPTIONS="patch_premain=false xray_naive_log=false \ -// RUN: xray_logfile_base=fdr-thread-order. xray_fdr_log=true verbosity=1 \ -// RUN: xray_fdr_log_func_duration_threshold_us=0" %run %t 2>&1 | \ +// RUN: rm -rf %t && mkdir %t +// RUN: %clangxx_xray -g -std=c++11 %s -o %t.exe +// RUN: XRAY_OPTIONS="patch_premain=false \ +// RUN: xray_logfile_base=%t/ xray_mode=xray-fdr verbosity=1" \ +// RUN: XRAY_FDR_OPTIONS=func_duration_threshold_us=0 %run %t.exe 2>&1 | \ // RUN: FileCheck %s -// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \ -// RUN: "`ls fdr-thread-order.* | head -1`" -// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \ -// RUN: "`ls fdr-thread-order.* | head -1`" | \ -// RUN: FileCheck %s --check-prefix TRACE -// RUN: rm fdr-thread-order.* +// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t.exe %t/* +// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t.exe %t/* | \ +// RUN: FileCheck %s --check-prefix TRACE // FIXME: Make llvm-xray work on non-x86_64 as well. // REQUIRES: x86_64-target-arch // REQUIRES: built-in-llvm-tree @@ -19,9 +16,6 @@ #include <cassert> #include <thread> -constexpr auto kBufferSize = 16384; -constexpr auto kBufferMax = 10; - std::atomic<uint64_t> var{0}; [[clang::xray_always_instrument]] void __attribute__((noinline)) f1() { @@ -35,11 +29,8 @@ std::atomic<uint64_t> var{0}; } int main(int argc, char *argv[]) { - using namespace __xray; - FDRLoggingOptions Options; __xray_patch(); - assert(__xray_log_init(kBufferSize, kBufferMax, &Options, - sizeof(FDRLoggingOptions)) == + assert(__xray_log_init_mode("xray-fdr", "") == XRayLogInitStatus::XRAY_LOG_INITIALIZED); std::atomic_thread_fence(std::memory_order_acq_rel); @@ -61,7 +52,7 @@ int main(int argc, char *argv[]) { } // We want to make sure that the order of the function log doesn't matter. -// TRACE-DAG: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*f1.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FID2:[0-9]+]], function: {{.*f2.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FID1]], function: {{.*f1.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: {{function-exit|function-tail-exit}}, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[FID2]], function: {{.*f2.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: {{function-exit|function-tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[FID1:[0-9]+]], function: {{.*f1.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FID2:[0-9]+]], function: {{.*f2.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FID1]], function: {{.*f1.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS]], kind: {{function-exit|function-tail-exit}}, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[FID2]], function: {{.*f2.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS]], kind: {{function-exit|function-tail-exit}}, tsc: {{[0-9]+}}, data: '' } diff --git a/test/xray/TestCases/Posix/fork_basic_logging.cc b/test/xray/TestCases/Posix/fork_basic_logging.cc index 5aefdec08016d..3873325ef746b 100644 --- a/test/xray/TestCases/Posix/fork_basic_logging.cc +++ b/test/xray/TestCases/Posix/fork_basic_logging.cc @@ -11,6 +11,9 @@ // REQUIRES: x86_64-target-arch // REQUIRES: built-in-llvm-tree +// Not ported. +// UNSUPPORTED: netbsd + #include "xray/xray_log_interface.h" #include <stdio.h> #include <unistd.h> @@ -81,20 +84,20 @@ int main() } // Make sure we know which thread is the parent process -// TRACE-DAG: - { type: 0, func-id: [[LSGT:[0-9]+]], function: {{.*log_syscall_gettid.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS1:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[LSGT:[0-9]+]], function: {{.*log_syscall_gettid.*}}, cpu: {{.*}}, thread: [[THREAD1:[0-9]+]], process: [[PROCESS1:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } -// TRACE-DAG: - { type: 0, func-id: [[PPOC:[0-9]+]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-enter, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[PPOC:[0-9]+]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } // // The parent will print its pid -// TRACE-DAG: - { type: 0, func-id: [[PPTARG:[0-9]+]], function: {{.*print_parent_tid.*}}, args: [ [[THREAD1]] ], cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-enter-arg, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[PPTARG]], function: {{.*print_parent_tid.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-exit, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[PPTARG:[0-9]+]], function: {{.*print_parent_tid.*}}, args: [ [[THREAD1]] ], cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-enter-arg, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[PPTARG]], function: {{.*print_parent_tid.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-exit, tsc: {{[0-9]+}}, data: '' } // -// TRACE-DAG - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } -// TRACE-DAG: - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS2:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD2:[0-9]+]], process: [[PROCESS2:[0-9]+]], kind: function-enter, tsc: {{[0-9]+}}, data: '' } // // The child will print its pid -// TRACE-DAG: - { type: 0, func-id: [[PCTARG:[0-9]+]], function: {{.*print_child_tid.*}}, args: [ [[THREAD2]] ], cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-enter-arg, tsc: {{[0-9]+}} } -// TRACE-DAG: - { type: 0, func-id: [[PCTARG]], function: {{.*print_child_tid.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-exit, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[PCTARG:[0-9]+]], function: {{.*print_child_tid.*}}, args: [ [[THREAD2]] ], cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-enter-arg, tsc: {{[0-9]+}}, data: '' } +// TRACE-DAG: - { type: 0, func-id: [[PCTARG]], function: {{.*print_child_tid.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-exit, tsc: {{[0-9]+}}, data: '' } // -// TRACE-DAG: - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}} } +// TRACE-DAG: - { type: 0, func-id: [[PPOC]], function: {{.*print_parent_or_child.*}}, cpu: {{.*}}, thread: [[THREAD2]], process: [[PROCESS2]], kind: function-{{exit|tail-exit}}, tsc: {{[0-9]+}}, data: '' } diff --git a/test/xray/TestCases/Posix/profiling-multi-threaded.cc b/test/xray/TestCases/Posix/profiling-multi-threaded.cc index 45e5e70226da5..8bd15b7d312d5 100644 --- a/test/xray/TestCases/Posix/profiling-multi-threaded.cc +++ b/test/xray/TestCases/Posix/profiling-multi-threaded.cc @@ -41,7 +41,7 @@ volatile int buffer_counter = 0; std::string current_mode = __xray_log_get_current_mode(); assert(current_mode == "xray-profiling"); assert(__xray_patch() == XRayPatchingStatus::SUCCESS); - assert(__xray_log_init(0, 0, nullptr, 0) == + assert(__xray_log_init_mode("xray-profiling", "") == XRayLogInitStatus::XRAY_LOG_INITIALIZED); std::thread t0([] { f0(); }); std::thread t1([] { f0(); }); |