From 0db35980a0b8de92665de63dda79fe4995c5347f Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 18 Oct 2023 11:28:51 +0200 Subject: [PATCH] Add a test for multiple values of OVNI_TRACEDIR --- test/emu/ovni/CMakeLists.txt | 1 + test/emu/ovni/tracedir-subdir.c | 15 +++++++++++++++ test/emu/ovni/tracedir-subdir.driver.sh | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 test/emu/ovni/tracedir-subdir.c create mode 100644 test/emu/ovni/tracedir-subdir.driver.sh diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index 513173a..a0fbe6b 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -16,3 +16,4 @@ test_emu(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate") test_emu(no-cpus.c SHOULD_FAIL REGEX "loom .* has no physical CPUs") test_emu(sort-cpus-by-loom.c MP) test_emu(sort-cpus-by-rank.c MP) +test_emu(tracedir-subdir.c MP DRIVER "tracedir-subdir.driver.sh") diff --git a/test/emu/ovni/tracedir-subdir.c b/test/emu/ovni/tracedir-subdir.c new file mode 100644 index 0000000..ff5ff4c --- /dev/null +++ b/test/emu/ovni/tracedir-subdir.c @@ -0,0 +1,15 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include "compat.h" +#include "instr.h" + +int +main(void) +{ + instr_start(0, 1); + instr_end(); + + return 0; +} diff --git a/test/emu/ovni/tracedir-subdir.driver.sh b/test/emu/ovni/tracedir-subdir.driver.sh new file mode 100644 index 0000000..80fb4e9 --- /dev/null +++ b/test/emu/ovni/tracedir-subdir.driver.sh @@ -0,0 +1,24 @@ +target=$OVNI_TEST_BIN + +# Test referring to a empty nested subdirectory +( + export OVNI_TRACEDIR=a/b/c + $target + ovniemu $OVNI_TRACEDIR +) + +# Test referring to a parent directory +( + mkdir -p x/y/z + cd x/y/z + export OVNI_TRACEDIR=../../w + $target + ovniemu $OVNI_TRACEDIR +) + +# Test with full path +( + export OVNI_TRACEDIR=$(pwd)/fullpath + $target + ovniemu $OVNI_TRACEDIR +)