From 62a908e81aa786e902fa526e7145a3e7000345c8 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 12 Dec 2023 01:10:55 +0000 Subject: [PATCH] rebuild-testbench.sh: error when unknown arguments are passed Silently discarding user input is really bad. Signed-off-by: Marc Herbert --- scripts/rebuild-testbench.sh | 9 +++++++++ tools/testbench/CMakeLists.txt | 2 ++ 2 files changed, 11 insertions(+) diff --git a/scripts/rebuild-testbench.sh b/scripts/rebuild-testbench.sh index 5e5d14d0adbd..76da4acba98c 100755 --- a/scripts/rebuild-testbench.sh +++ b/scripts/rebuild-testbench.sh @@ -136,7 +136,16 @@ main() esac done + # This automagically removes the -- sentinel itself if any. + shift "$((OPTIND -1))" + # Error on spurious arguments. + test $# -eq 0 || { + print_usage + die "Unknown arguments: %s\n" "$*" + } + rebuild_testbench + printf '\n' testbench_usage } diff --git a/tools/testbench/CMakeLists.txt b/tools/testbench/CMakeLists.txt index 76a3716571ee..8e95a60d6a14 100644 --- a/tools/testbench/CMakeLists.txt +++ b/tools/testbench/CMakeLists.txt @@ -50,6 +50,8 @@ install(TARGETS testbench DESTINATION bin) include(ExternalProject) +# Should we do this? Only for sof_ep, not for parser_ep? +# https://stackoverflow.com/questions/12021448/how-can-cmake-arguments-be-forwarded-to-externalproject ExternalProject_Add(sof_ep DOWNLOAD_COMMAND "" SOURCE_DIR "${sof_source_directory}"