@@ -663,7 +663,7 @@ get_reusability_score() {
663663
664664 # Score 2: Reusable - optionals can be reused by source scenarios
665665 case " ${boot_image} " in
666- * -optionals|* -optional| * - with-optional)
666+ * -optionals|* -with-optional)
667667 echo " 2"
668668 return
669669 ;;
@@ -1412,65 +1412,72 @@ show_status() {
14121412 echo " === Test Durations ==="
14131413 echo " (Tests longer than avg boot time should be 'slow', shorter should be 'fast')"
14141414 echo " "
1415- # Collect test durations and check for mislabeling
1416- local mislabeled_count=0
1417- {
1418- for scenario_dir in " ${SCENARIO_INFO_DIR} " /* ; do
1419- [ -d " ${scenario_dir} " ] || continue
1420- local scenario_name
1421- scenario_name=$( basename " ${scenario_dir} " )
1422- local test_time_file=" ${scenario_dir} /test_time"
1423-
1424- if [ -f " ${test_time_file} " ]; then
1425- local test_time
1426- test_time=$( cat " ${test_time_file} " )
1427- local test_mins=$(( test_time / 60 ))
1428- local test_secs=$(( test_time % 60 ))
1429- local time_str
1430- time_str=$( printf ' %2d:%02d' " ${test_mins} " " ${test_secs} " )
1431-
1432- # Get slow/fast flag from requirements
1433- local req_file=" ${SCENARIO_STATUS} /${scenario_name} /requirements"
1434- local slow_flag=" false"
1435- local fast_flag=" false"
1436- local current_label=" -"
1437- if [ -f " ${req_file} " ]; then
1438- slow_flag=$( get_req_value " ${req_file} " " slow" " false" )
1439- fast_flag=$( get_req_value " ${req_file} " " fast" " false" )
1440- if [ " ${slow_flag} " = " true" ]; then
1441- current_label=" slow"
1442- elif [ " ${fast_flag} " = " true" ]; then
1443- current_label=" fast"
1444- fi
1415+ # Collect test durations to a temp file for sorting and counting
1416+ local tmp_durations
1417+ tmp_durations=$( mktemp)
1418+ # shellcheck disable=SC2064
1419+ trap " rm -f ${tmp_durations} " RETURN
1420+
1421+ for scenario_dir in " ${SCENARIO_INFO_DIR} " /* ; do
1422+ [ -d " ${scenario_dir} " ] || continue
1423+ local scenario_name
1424+ scenario_name=$( basename " ${scenario_dir} " )
1425+ local test_time_file=" ${scenario_dir} /test_time"
1426+
1427+ if [ -f " ${test_time_file} " ]; then
1428+ local test_time
1429+ test_time=$( cat " ${test_time_file} " )
1430+ local test_mins=$(( test_time / 60 ))
1431+ local test_secs=$(( test_time % 60 ))
1432+ local time_str
1433+ time_str=$( printf ' %2d:%02d' " ${test_mins} " " ${test_secs} " )
1434+
1435+ # Get slow/fast flag from requirements
1436+ local req_file=" ${SCENARIO_STATUS} /${scenario_name} /requirements"
1437+ local slow_flag=" false"
1438+ local fast_flag=" false"
1439+ local current_label=" -"
1440+ if [ -f " ${req_file} " ]; then
1441+ slow_flag=$( get_req_value " ${req_file} " " slow" " false" )
1442+ fast_flag=$( get_req_value " ${req_file} " " fast" " false" )
1443+ if [ " ${slow_flag} " = " true" ]; then
1444+ current_label=" slow"
1445+ elif [ " ${fast_flag} " = " true" ]; then
1446+ current_label=" fast"
14451447 fi
1448+ fi
14461449
1447- # Determine if mislabeled (compare against avg boot time)
1448- local status=" "
1449- if [ ${avg_boot_time} -gt 0 ]; then
1450- if [ ${test_time} -gt ${avg_boot_time} ]; then
1451- # Test is slower than boot - should be 'slow'
1452- if [ " ${fast_flag} " = " true" ]; then
1453- status=" <-- MISLABELED (should be slow)"
1454- mislabeled_count=$(( mislabeled_count + 1 ))
1455- fi
1456- else
1457- # Test is faster than boot - should be 'fast'
1458- if [ " ${slow_flag} " = " true" ]; then
1459- status=" <-- MISLABELED (should be fast)"
1460- mislabeled_count=$(( mislabeled_count + 1 ))
1461- fi
1450+ # Determine if mislabeled (compare against avg boot time)
1451+ local status=" "
1452+ if [ " ${avg_boot_time} " -gt 0 ]; then
1453+ if [ " ${test_time} " -gt " ${avg_boot_time} " ]; then
1454+ # Test is slower than boot - should be 'slow'
1455+ if [ " ${fast_flag} " = " true" ]; then
1456+ status=" <-- MISLABELED (should be slow)"
1457+ fi
1458+ else
1459+ # Test is faster than boot - should be 'fast'
1460+ if [ " ${slow_flag} " = " true" ]; then
1461+ status=" <-- MISLABELED (should be fast)"
14621462 fi
14631463 fi
1464-
1465- # Output: time, scenario, label, status (tab-separated for sorting)
1466- printf " %d\t%s\t%-40s\t%-6s\t%s\n" " ${test_time} " " ${time_str} " " ${scenario_name} " " ${current_label} " " ${status} "
14671464 fi
1468- done
1469- } | sort -t$' \t ' -k1,1rn | cut -f2- | while IFS=$' \t ' read -r time_str scenario label status; do
1465+
1466+ # Output: time, scenario, label, status (tab-separated for sorting)
1467+ printf " %d\t%s\t%-40s\t%-6s\t%s\n" " ${test_time} " " ${time_str} " " ${scenario_name} " " ${current_label} " " ${status} " >> " ${tmp_durations} "
1468+ fi
1469+ done
1470+
1471+ # Sort and display
1472+ sort -t$' \t ' -k1,1rn " ${tmp_durations} " | cut -f2- | while IFS=$' \t ' read -r time_str scenario label status; do
14701473 printf " %s %-40s [%s] %s\n" " ${time_str} " " ${scenario} " " ${label} " " ${status} "
14711474 done
1475+
1476+ # Count mislabeled
1477+ local mislabeled_count
1478+ mislabeled_count=$( grep -c " MISLABELED" " ${tmp_durations} " 2> /dev/null || echo 0)
14721479 echo " "
1473- if [ ${mislabeled_count} -gt 0 ]; then
1480+ if [ " ${mislabeled_count} " -gt 0 ]; then
14741481 echo " WARNING: ${mislabeled_count} test(s) appear to be mislabeled based on avg boot time (${avg_boot_time_str} )"
14751482 fi
14761483 echo " "
0 commit comments