From 19175a5d8f1520db6c9f8091224133bf2d0bb95c Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Mon, 5 Sep 2022 09:45:14 -0700 Subject: [PATCH] [SYCL] Prevent skipped GPU run from overwriting CPU output in DeviceLib/assert.cpp Though the two potential runs in DeviceLib/assert.cpp are mutually exclusive, skipping the latter run (GPU) will still trigger a write to the output file, overwriting the results from the previous (CPU) run. To avoid this, these changes first ensures the output file is cleared then makes the runs append their output to the file. Since the runs are mutually exclusive the file should at most contain the output of one expected run. Signed-off-by: Larsen, Steffen --- SYCL/DeviceLib/assert.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SYCL/DeviceLib/assert.cpp b/SYCL/DeviceLib/assert.cpp index 62c1cccaee..8fb0bd3658 100644 --- a/SYCL/DeviceLib/assert.cpp +++ b/SYCL/DeviceLib/assert.cpp @@ -71,8 +71,12 @@ // // Overall this sounds stable enough. What could possibly go wrong? // -// RUN: %CPU_RUN_PLACEHOLDER env SYCL_PI_TRACE=2 SHOULD_CRASH=1 EXPECTED_SIGNAL=SIGABRT %t.out 2>%t.stderr.native -// RUN: %GPU_RUN_PLACEHOLDER env SHOULD_CRASH=1 EXPECTED_SIGNAL=SIGIOT %t.out 2>%t.stderr.native +// With either a CPU run or a GPU run we reset the output file and append the +// results of the runs. Otherwise a skipped GPU run may remove the output from +// a CPU run prior to running FileCheck. +// RUN: echo "" > %t.stderr.native +// RUN: %CPU_RUN_PLACEHOLDER SYCL_PI_TRACE=2 SHOULD_CRASH=1 EXPECTED_SIGNAL=SIGABRT %t.out 2>> %t.stderr.native +// RUN: %GPU_RUN_PLACEHOLDER SHOULD_CRASH=1 EXPECTED_SIGNAL=SIGIOT %t.out 2>> %t.stderr.native // RUN: FileCheck %s --input-file %t.stderr.native --check-prefixes=CHECK-MESSAGE || FileCheck %s --input-file %t.stderr.native --check-prefix CHECK-NOTSUPPORTED // // Skip the test if the CPU RT doesn't support the extension yet: