Debian Codegraph @

util/copy_core_test_results.sh

raw
1 #!/bin/bash
2
3 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4
5 # Define the paths for both directory trees
6 tests_output_root_dir="/tmp/nerdlog_core_test_output"
7 tests_input_root_dir="${SCRIPT_DIR}/../core/core_testdata/test_cases_core"
8
9 # Convert tests_output_root_dir to absolute path for consistency
10 tests_output_root_dir=$(realpath "$tests_output_root_dir")
11
12 # Recurse into subdirectories
13 for scenario_output_dir in "$tests_output_root_dir"/*; do
14 scenario_name="${scenario_output_dir#$tests_output_root_dir/}"
15 scenario_input_dir="$tests_input_root_dir/$scenario_name"
16
17 for step_output_dir in "$scenario_output_dir"/steps/*; do
18 if [ -e "$step_output_dir/got_log_resp.txt" ]; then
19 # This is a query step, so copy the query output
20 want_filename_ptr="$step_output_dir/want_log_resp_filename.txt"
21 if ! [ -e "$want_filename_ptr" ]; then
22 exit 1
23 fi
24 want_filename="$(cat $want_filename_ptr)"
25
26 target_want_filename="$scenario_input_dir/$want_filename"
27 if ! [ -e "$target_want_filename" ]; then
28 echo "warn: $target_want_filename does not exist, skipping" 1>&2
29 continue
30 fi
31
32 #echo "Copying $step_output_dir/got_log_resp.txt -> $target_want_filename"
33 echo -n .
34 cp "$step_output_dir/got_log_resp.txt" "$target_want_filename"
35 elif [ -e "$step_output_dir/got_logstreams_manager_state.txt" ]; then
36 # This is a lstreams manager state check step, so copy the query output
37 want_filename_ptr="$step_output_dir/want_lsm_state_filename.txt"
38 if ! [ -e "$want_filename_ptr" ]; then
39 exit 1
40 fi
41 want_filename="$(cat $want_filename_ptr)"
42
43 target_want_filename="$scenario_input_dir/$want_filename"
44 if ! [ -e "$target_want_filename" ]; then
45 echo "warn: $target_want_filename does not exist, skipping" 1>&2
46 continue
47 fi
48
49 #echo "Copying $step_output_dir/got_logstreams_manager_state.txt -> $target_want_filename"
50 echo -n .
51 cp "$step_output_dir/got_logstreams_manager_state.txt" "$target_want_filename"
52 fi
53 done
54 done
55
56 echo ""
57 echo "All done"