From 06f6df72a0a743f7718e3c7e5ba164cc571bc8f8 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Fri, 9 Aug 2024 11:47:29 -0700 Subject: [PATCH] Do not copy files in the source tree when running tests. (#2062) * Do not copy files in the source tree when running tests. Currently running tests modifies the source tree. This confuses git into thinking new untracked changes have been created. These changes nip that in the bud. While we're here, change the processing of stderr output to use subshells instead of creating a temporary file. * Back out the change to not use a temp file, since it doesn't pass error codes back to the parent shell. sigh. Add a cleanup line to the script. --- targettests/execution/mapping_test-1-cpp17.cpp | 5 +++-- targettests/execution/mapping_test-1.cpp | 6 ++++-- targettests/lit.cfg.py | 7 +------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/targettests/execution/mapping_test-1-cpp17.cpp b/targettests/execution/mapping_test-1-cpp17.cpp index 111e25a599..1db7fe5eaf 100644 --- a/targettests/execution/mapping_test-1-cpp17.cpp +++ b/targettests/execution/mapping_test-1-cpp17.cpp @@ -7,9 +7,10 @@ ******************************************************************************/ // REQUIRES: c++17 -// RUN: nvq++ %cpp_std %s -o %t --target oqc --emulate && CUDAQ_DUMP_JIT_IR=1 %t 2> %t.code | FileCheck %s && FileCheck --check-prefix=QUAKE %s < %t.code && rm %t.code -// RUN: nvq++ %cpp_std %s -o %t --target iqm --iqm-machine Adonis --mapping-file "%p/../Adonis Variant.txt" --emulate && %t +// RUN: nvq++ %cpp_std %s -o %t --target oqc --emulate && CUDAQ_DUMP_JIT_IR=1 %t 2> %t.txt | FileCheck %s && FileCheck --check-prefix=QUAKE %s < %t.txt +// RUN: mkdir -p %t.dir && cp "%iqm_test_src_dir/Adonis.txt" "%t.dir/Adonis Variant.txt" && nvq++ %cpp_std %s -o %t --target iqm --iqm-machine Adonis --mapping-file "%t.dir/Adonis Variant.txt" --emulate && %t // RUN: nvq++ %cpp_std --enable-mlir %s -o %t +// RUN: rm -rf %t.txt %t.dir #include #include diff --git a/targettests/execution/mapping_test-1.cpp b/targettests/execution/mapping_test-1.cpp index 74cfbe112d..58dc4a7616 100644 --- a/targettests/execution/mapping_test-1.cpp +++ b/targettests/execution/mapping_test-1.cpp @@ -7,9 +7,11 @@ ******************************************************************************/ // REQUIRES: c++20 -// RUN: nvq++ %cpp_std %s -o %t --target oqc --emulate && CUDAQ_DUMP_JIT_IR=1 %t 2> %t.code | FileCheck %s && FileCheck --check-prefix=QUAKE %s < %t.code && rm %t.code -// RUN: nvq++ %cpp_std %s -o %t --target iqm --iqm-machine Adonis --mapping-file "%p/../Adonis Variant.txt" --emulate && %t +// clang-format off +// RUN: nvq++ %cpp_std %s -o %t --target oqc --emulate && CUDAQ_DUMP_JIT_IR=1 %t 2> %t.txt | FileCheck %s && FileCheck --check-prefix=QUAKE %s < %t.txt +// RUN: mkdir -p %t.dir && cp "%iqm_test_src_dir/Adonis.txt" "%t.dir/Adonis Variant.txt" && nvq++ %cpp_std %s -o %t --target iqm --iqm-machine Adonis --mapping-file "%t.dir/Adonis Variant.txt" --emulate && %t // RUN: nvq++ %cpp_std --enable-mlir %s -o %t +// RUN: rm -rf %t.txt %t.dir #include #include diff --git a/targettests/lit.cfg.py b/targettests/lit.cfg.py index d16a034444..a15438026b 100644 --- a/targettests/lit.cfg.py +++ b/targettests/lit.cfg.py @@ -36,6 +36,7 @@ config.substitutions.append(('%cudaq_plugin_ext', config.cudaq_plugin_ext)) config.substitutions.append(('%cudaq_target_dir', config.cudaq_target_dir)) config.substitutions.append(('%cudaq_src_dir', config.cudaq_src_dir)) +config.substitutions.append(('%iqm_test_src_dir', config.cudaq_src_dir + "/runtime/cudaq/platform/default/rest/helpers/iqm")) llvm_config.use_default_substitutions() @@ -71,9 +72,3 @@ # Tweak the PATH to include the tools directory. llvm_config.with_environment('PATH', config.cudaq_tools_dir, append_path=True) llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) - -# Create some of the test inputs. -target_config_origin = os.path.join(config.cudaq_src_dir, "runtime/cudaq/platform/default/rest/helpers/iqm") -target_config_dest = os.path.join(config.cudaq_src_dir, "targettests") -shutil.copy(os.path.join(target_config_origin, "Adonis.txt"), os.path.join(target_config_dest, "Adonis Variant.txt")) -shutil.copy(os.path.join(target_config_origin, "Apollo.txt"), os.path.join(target_config_dest, "Apollo Variant.txt"))