Reorganize test scripts

This allows for a cleaner organization of different test categories.
pull/13/head
nirenjan 2017-08-03 16:59:07 -07:00
parent d9732d498d
commit 2c2dbb3c42
42 changed files with 97 additions and 91 deletions

View File

@ -4,46 +4,46 @@ SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS = AM_SH_LOG_FLAGS =
TESTS = \ TESTS = \
test_led_fire_off.sh \ led/test_led_fire_off.sh \
test_led_fire_on.sh \ led/test_led_fire_on.sh \
test_led_throttle_off.sh \ led/test_led_throttle_off.sh \
test_led_throttle_on.sh \ led/test_led_throttle_on.sh \
test_led_a_off.sh \ led/test_led_a_off.sh \
test_led_a_red.sh \ led/test_led_a_red.sh \
test_led_a_amber.sh \ led/test_led_a_amber.sh \
test_led_a_green.sh \ led/test_led_a_green.sh \
test_led_b_off.sh \ led/test_led_b_off.sh \
test_led_b_red.sh \ led/test_led_b_red.sh \
test_led_b_amber.sh \ led/test_led_b_amber.sh \
test_led_b_green.sh \ led/test_led_b_green.sh \
test_led_d_off.sh \ led/test_led_d_off.sh \
test_led_d_red.sh \ led/test_led_d_red.sh \
test_led_d_amber.sh \ led/test_led_d_amber.sh \
test_led_d_green.sh \ led/test_led_d_green.sh \
test_led_e_off.sh \ led/test_led_e_off.sh \
test_led_e_red.sh \ led/test_led_e_red.sh \
test_led_e_amber.sh \ led/test_led_e_amber.sh \
test_led_e_green.sh \ led/test_led_e_green.sh \
test_led_t1_off.sh \ led/test_led_t1_off.sh \
test_led_t1_red.sh \ led/test_led_t1_red.sh \
test_led_t1_amber.sh \ led/test_led_t1_amber.sh \
test_led_t1_green.sh \ led/test_led_t1_green.sh \
test_led_t2_off.sh \ led/test_led_t2_off.sh \
test_led_t2_red.sh \ led/test_led_t2_red.sh \
test_led_t2_amber.sh \ led/test_led_t2_amber.sh \
test_led_t2_green.sh \ led/test_led_t2_green.sh \
test_led_t3_off.sh \ led/test_led_t3_off.sh \
test_led_t3_red.sh \ led/test_led_t3_red.sh \
test_led_t3_amber.sh \ led/test_led_t3_amber.sh \
test_led_t3_green.sh \ led/test_led_t3_green.sh \
test_led_pov_off.sh \ led/test_led_pov_off.sh \
test_led_pov_red.sh \ led/test_led_pov_red.sh \
test_led_pov_amber.sh \ led/test_led_pov_amber.sh \
test_led_pov_green.sh \ led/test_led_pov_green.sh \
test_led_clutch_off.sh \ led/test_led_clutch_off.sh \
test_led_clutch_red.sh \ led/test_led_clutch_red.sh \
test_led_clutch_amber.sh \ led/test_led_clutch_amber.sh \
test_led_clutch_green.sh \ led/test_led_clutch_green.sh \
test_skip.sh test_skip.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the A button to amber # Test setting the A button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_A_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_A_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the A button to green # Test setting the A button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_A_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_A_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the A button to off # Test setting the A button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_A_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_A_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the A button to red # Test setting the A button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_A_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_A_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the B button to amber # Test setting the B button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_B_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_B_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the B button to green # Test setting the B button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_B_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_B_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the B button to off # Test setting the B button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_B_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_B_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the B button to red # Test setting the B button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_B_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_B_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the CLUTCH button to amber # Test setting the CLUTCH button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the CLUTCH button to green # Test setting the CLUTCH button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the CLUTCH button to off # Test setting the CLUTCH button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the CLUTCH button to red # Test setting the CLUTCH button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_CLUTCH_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the D button to amber # Test setting the D button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_D_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_D_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the D button to green # Test setting the D button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_D_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_D_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the D button to off # Test setting the D button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_D_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_D_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the D button to red # Test setting the D button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_D_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_D_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the E button to amber # Test setting the E button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_E_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_E_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the E button to green # Test setting the E button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_E_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_E_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the E button to off # Test setting the E button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_E_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_E_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the E button to red # Test setting the E button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_E_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_E_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the FIRE button off # Test setting the FIRE button off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_FIRE_OFF expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_FIRE_OFF

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the FIRE button on # Test setting the FIRE button on
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_FIRE_ON expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_FIRE_ON

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the POV button to amber # Test setting the POV button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_POV_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_POV_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the POV button to green # Test setting the POV button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_POV_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_POV_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the POV button to off # Test setting the POV button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_POV_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_POV_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the POV button to red # Test setting the POV button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_POV_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_POV_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T1 button to amber # Test setting the T1 button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T1_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T1_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T1 button to green # Test setting the T1 button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T1_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T1_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T1 button to off # Test setting the T1 button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T1_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T1_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T1 button to red # Test setting the T1 button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T1_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T1_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T2 button to amber # Test setting the T2 button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T2_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T2_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T2 button to green # Test setting the T2 button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T2_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T2_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T2 button to off # Test setting the T2 button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T2_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T2_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T2 button to red # Test setting the T2 button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T2_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T2_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T3 button to amber # Test setting the T3 button to amber
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T3_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T3_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T3 button to green # Test setting the T3 button to green
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T3_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T3_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T3 button to off # Test setting the T3 button to off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T3_RED_OFF \ $X52_LED_COMMAND_INDEX $X52_LED_T3_RED_OFF \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the T3 button to red # Test setting the T3 button to red
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern \ expect_pattern \
$X52_LED_COMMAND_INDEX $X52_LED_T3_RED_ON \ $X52_LED_COMMAND_INDEX $X52_LED_T3_RED_ON \

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the THROTTLE button off # Test setting the THROTTLE button off
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_THROTTLE_OFF expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_THROTTLE_OFF

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Test setting the THROTTLE button on # Test setting the THROTTLE button on
source $(dirname $0)/common_infra.sh source $(dirname $0)/../common_infra.sh
expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_THROTTLE_ON expect_pattern $X52_LED_COMMAND_INDEX $X52_LED_THROTTLE_ON

View File

@ -4,16 +4,23 @@
# and saved in the repository so that the automake infrastructure can pick them # and saved in the repository so that the automake infrastructure can pick them
# up. # up.
_test_header()
{
cat << EOF
#!/bin/bash
# $@
source \$(dirname \$0)/../common_infra.sh
EOF
}
_mono_led_template() _mono_led_template()
{ {
local led_ident=$(echo $1 | tr a-z A-Z) local led_ident=$(echo $1 | tr a-z A-Z)
local led_color=$2 local led_color=$2
local state=$(echo "\$X52_LED_${led_ident}_${led_color}" | tr a-z A-Z) local state=$(echo "\$X52_LED_${led_ident}_${led_color}" | tr a-z A-Z)
cat << EOF cat << EOF
#!/bin/bash $(_test_header Test setting the $led_ident button $led_color)
# Test setting the $led_ident button $led_color
source \$(dirname \$0)/common_infra.sh
expect_pattern \$X52_LED_COMMAND_INDEX $state expect_pattern \$X52_LED_COMMAND_INDEX $state
@ -48,10 +55,7 @@ _color_led_template()
led_g_state=$(echo "\$X52_LED_${led_ident}_green_${led_g_state}" | tr a-z A-Z) led_g_state=$(echo "\$X52_LED_${led_ident}_green_${led_g_state}" | tr a-z A-Z)
cat << EOF cat << EOF
#!/bin/bash $(_test_header Test setting the $led_ident button to $led_color)
# Test setting the $led_ident button to $led_color
source \$(dirname \$0)/common_infra.sh
expect_pattern \\ expect_pattern \\
\$X52_LED_COMMAND_INDEX $led_r_state \\ \$X52_LED_COMMAND_INDEX $led_r_state \\
@ -66,12 +70,14 @@ EOF
make_led_tests() make_led_tests()
{ {
mkdir -p led
# Make the mono-color LED tests # Make the mono-color LED tests
for led in fire throttle for led in fire throttle
do do
for state in off on for state in off on
do do
filename=test_led_${led}_${state}.sh filename=led/test_led_${led}_${state}.sh
_mono_led_template $led $state > $filename _mono_led_template $led $state > $filename
echo -e "\t$filename \\" >> Makefile.am echo -e "\t$filename \\" >> Makefile.am
done done
@ -82,8 +88,8 @@ make_led_tests()
do do
for state in off red amber green for state in off red amber green
do do
filename=test_led_${led}_${state}.sh filename=led/test_led_${led}_${state}.sh
_color_led_template $led $state > test_led_${led}_${state}.sh _color_led_template $led $state > $filename
echo -e "\t$filename \\" >> Makefile.am echo -e "\t$filename \\" >> Makefile.am
done done
done done