tests/utils/utils.sh: bt_diff_details_ctf_gen_single(): use `local -r` when possible
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 10 Nov 2023 04:15:54 +0000 (23:15 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 7 Feb 2024 21:25:56 +0000 (16:25 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I18c910ca25a680fde94528dbe3bf11f908b77b77

tests/utils/utils.sh

index d82709059b19214062e9ddac3962e6571dae1422..9291db8833e6a8340e0452276d2714788ccd2ed5 100644 (file)
@@ -329,15 +329,12 @@ bt_diff_details_ctf_single() {
 # The program `$1` receives the path to a temporary, empty directory
 # where to write the CTF trace as its first argument.
 bt_diff_details_ctf_gen_single() {
-       local ctf_gen_prog_path="$1"
-       local expected_stdout_file="$2"
+       local -r ctf_gen_prog_path="$1"
+       local -r expected_stdout_file="$2"
        shift 2
-       local extra_details_args=("$@")
-
-       local temp_trace_dir
-       local ret
+       local -r extra_details_args=("$@")
 
-       temp_trace_dir="$(mktemp -d)"
+       local -r temp_trace_dir="$(mktemp -d)"
 
        # Run the CTF trace generator program to get a CTF trace
        if ! "$ctf_gen_prog_path" "$temp_trace_dir" 2>/dev/null; then
@@ -349,7 +346,7 @@ bt_diff_details_ctf_gen_single() {
        # Compare using the CLI with `sink.text.details`
        bt_diff_details_ctf_single "$expected_stdout_file" "$temp_trace_dir" \
                "${extra_details_args[@]+${extra_details_args[@]}}"
-       ret=$?
+       local -r ret=$?
        rm -rf "$temp_trace_dir"
        return $ret
 }
This page took 0.024764 seconds and 4 git commands to generate.