Skip to content

Commit fe52c97

Browse files
committed
Modified the find command to identify the testcase
Modified the function find_test_case_by_name and run_specific_test_by_name in run-test.sh to find the testcase to execute easily without depending on find command Removed unwanted lines from run-test.sh as it is dead code Signed-off-by: Vamsee Narapareddi <[email protected]>
1 parent f362d6d commit fe52c97

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

Runner/run-test.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,27 @@
1111

1212
# Find test case path by name
1313
find_test_case_by_name() {
14-
local test_name="$1"
15-
find /var/Runner/suites -type d -iname "$test_name" 2>/dev/null
14+
# Check if the file is a directory
15+
if [ -d "$1" ]; then
16+
# Get the directory name
17+
dir_name_in_dir=${1##*/}
18+
19+
# Check if the directory name matches the user input (ignoring case)
20+
if [ "${dir_name_in_dir,,}" = "$test_name" ]; then
21+
# Get the absolute path of the directory
22+
abs_path=$(readlink -f "$1")
23+
echo "$abs_path"
24+
fi
25+
fi
26+
27+
# Recursively search for the directory in the subdirectory
28+
for file in "$1"/*; do
29+
# Check if the file is a directory
30+
if [ -d "$file" ]; then
31+
# Recursively search for the directory in the subdirectory
32+
find_test_case_by_name "$file"
33+
fi
34+
done
1635
}
1736

1837
# Execute a test case
@@ -23,11 +42,6 @@ execute_test_case() {
2342
if [ -f "$run_script" ]; then
2443
log "Executing test case: $test_path"
2544
sh "$run_script" 2>&1
26-
# if [ $? -eq 0 ]; then
27-
# log "Test case $test_path passed."
28-
# else
29-
# log "Test case $test_path failed."
30-
# fi
3145
else
3246
log "No run.sh found in $test_path"
3347
fi
@@ -38,8 +52,9 @@ execute_test_case() {
3852

3953
# Function to run a specific test case by name
4054
run_specific_test_by_name() {
41-
local test_name="$1"
42-
test_path=$(find_test_case_by_name "$test_name")
55+
test_name="$1"
56+
test_name=${test_name,,}
57+
test_path=$(find_test_case_by_name ".")
4358
if [ -z "$test_path" ]; then
4459
log "Test case with name $test_name not found."
4560
else
@@ -54,4 +69,4 @@ if [ "$#" -eq 0 ]; then
5469
fi
5570

5671

57-
run_specific_test_by_name "$1"
72+
run_specific_test_by_name "$1"

0 commit comments

Comments
 (0)