mirror of https://github.com/nirenjan/libx52.git
Add test cases for blink and shift indicators
parent
8f7c262ea6
commit
994c39ce3c
|
@ -302,6 +302,10 @@ TESTS = \
|
|||
brightness/test_brightness_led_7e.sh \
|
||||
brightness/test_brightness_led_7f.sh \
|
||||
brightness/test_brightness_led_80.sh \
|
||||
indicator/test_blink_on.sh \
|
||||
indicator/test_blink_off.sh \
|
||||
indicator/test_shift_on.sh \
|
||||
indicator/test_shift_off.sh \
|
||||
test_skip.sh
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,11 @@ X52_LED_THROTTLE_OFF='1400'
|
|||
X52_MFD_BRIGHTNESS_INDEX='00b1'
|
||||
X52_LED_BRIGHTNESS_INDEX='00b2'
|
||||
|
||||
X52_BLINK_INDICATOR_INDEX='00b4'
|
||||
X52_SHIFT_INDICATOR_INDEX='00fd'
|
||||
X52_INDICATOR_STATE_ON='0051'
|
||||
X52_INDICATOR_STATE_OFF='0050'
|
||||
|
||||
find_programs()
|
||||
{
|
||||
# Tests and distcheck do not work on OSX, skip the tests
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Test setting blink indicator OFF
|
||||
|
||||
source $(dirname $0)/../common_infra.sh
|
||||
|
||||
expect_pattern $X52_BLINK_INDICATOR_INDEX $X52_INDICATOR_STATE_OFF
|
||||
|
||||
$X52CLI BLINK OFF
|
||||
|
||||
verify_output
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Test setting blink indicator ON
|
||||
|
||||
source $(dirname $0)/../common_infra.sh
|
||||
|
||||
expect_pattern $X52_BLINK_INDICATOR_INDEX $X52_INDICATOR_STATE_ON
|
||||
|
||||
$X52CLI BLINK ON
|
||||
|
||||
verify_output
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Test setting shift indicator OFF
|
||||
|
||||
source $(dirname $0)/../common_infra.sh
|
||||
|
||||
expect_pattern $X52_SHIFT_INDICATOR_INDEX $X52_INDICATOR_STATE_OFF
|
||||
|
||||
$X52CLI SHIFT OFF
|
||||
|
||||
verify_output
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Test setting shift indicator ON
|
||||
|
||||
source $(dirname $0)/../common_infra.sh
|
||||
|
||||
expect_pattern $X52_SHIFT_INDICATOR_INDEX $X52_INDICATOR_STATE_ON
|
||||
|
||||
$X52CLI SHIFT ON
|
||||
|
||||
verify_output
|
||||
|
|
@ -135,6 +135,41 @@ make_brightness_tests()
|
|||
done
|
||||
}
|
||||
|
||||
# Template for blink and shift test cases
|
||||
_blink_n_shift_template()
|
||||
{
|
||||
local indicator=$(echo $1 | tr a-z A-Z)
|
||||
local state=$(echo $2 | tr a-z A-Z)
|
||||
local index="\$X52_${indicator}_INDICATOR_INDEX"
|
||||
local value="\$X52_INDICATOR_STATE_${state}"
|
||||
|
||||
cat <<EOF
|
||||
$(_test_header Test setting $1 indicator $state)
|
||||
|
||||
expect_pattern $index $value
|
||||
|
||||
\$X52CLI $indicator $state
|
||||
|
||||
verify_output
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Function to generate test cases for blink and shift indicators
|
||||
make_indicator_tests()
|
||||
{
|
||||
mkdir -p indicator
|
||||
for indicator in blink shift
|
||||
do
|
||||
for state in on off
|
||||
do
|
||||
filename=indicator/test_${indicator}_${state}.sh
|
||||
_blink_n_shift_template $indicator $state > $filename
|
||||
echo -e "\t$filename \\" >> Makefile.am
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# Function to setup Makefile.am to receive the generated test cases
|
||||
clear_tests()
|
||||
{
|
||||
|
@ -156,4 +191,5 @@ finalize_tests()
|
|||
clear_tests
|
||||
make_led_tests
|
||||
make_brightness_tests
|
||||
make_indicator_tests
|
||||
finalize_tests
|
||||
|
|
Loading…
Reference in New Issue