Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/linux-sunxi/sunxi-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBernhard Nortmann <bernhard.nortmann@web.de>2016-06-03 11:03:37 +0300
committerBernhard Nortmann <bernhard.nortmann@web.de>2016-11-12 15:38:40 +0300
commit5cbb0c91a4ff81d989218afdf8b62f2e70df78d2 (patch)
tree88b959a33db110da1cb1adfc013c2ee8d08dee4b /tests
parentdc1b5889c34e843048375375f8e1dd9f2c4a3d8c (diff)
tests: Introduce a basic testing framework
All tests should go into the new "tests" subdirectory. The idea is that the separate Makefile in that directory will get invoked via a top-level "make check". The tests/Makefile should then take care of running all available tests, returning an appropriate exit status. Future tests may be functional, examine code metrics (coverage analysis), or both. For a start, I'd simply like to check that sunxi-fexc is able to properly compile all the .fex files from linux-sunxi/sunxi-boards. (Note: This currently FAILS and will probably require adjustments to both sunxi-tools and the .fex repository. To work around this, for now I'm applying patches to fix sunxi-boards.) Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile24
-rwxr-xr-xtests/fextest.sh8
-rw-r--r--tests/patches/a-star_kv49l.patch55
-rwxr-xr-xtests/test_all_fex.sh7
4 files changed, 94 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..de9960c
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,24 @@
+#
+# tests/Makefile
+#
+
+BOARDS_URL := https://github.com/linux-sunxi/sunxi-boards/archive/master.zip
+BOARDS_DIR := sunxi-boards
+
+check: check_all_fex
+
+check_all_fex: $(BOARDS_DIR)/README
+ ./test_all_fex.sh $(BOARDS_DIR)
+
+# Retrieve and extract sunxi-boards archive (containing all .fex)
+$(BOARDS_DIR).zip:
+ curl -fLsS -o $@ $(BOARDS_URL)
+$(BOARDS_DIR)/README: $(BOARDS_DIR).zip
+ @echo Extracting $< ...
+ unzip -q $<
+ mv sunxi-boards-master $(BOARDS_DIR)
+ touch -r $(BOARDS_DIR) $<
+ cat patches/*.patch | patch -p1
+
+clean:
+ rm -rf $(BOARDS_DIR).zip $(BOARDS_DIR)
diff --git a/tests/fextest.sh b/tests/fextest.sh
new file mode 100755
index 0000000..05f7b82
--- /dev/null
+++ b/tests/fextest.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+echo $0 $*
+FEX2BIN=../fex2bin
+BIN2FEX=../bin2fex
+FEX=$1
+BIN=${FEX/%.fex/.bin}
+REVERSE=${FEX/%.fex/.new}
+${FEX2BIN} ${FEX} ${BIN}
diff --git a/tests/patches/a-star_kv49l.patch b/tests/patches/a-star_kv49l.patch
new file mode 100644
index 0000000..799ae1a
--- /dev/null
+++ b/tests/patches/a-star_kv49l.patch
@@ -0,0 +1,55 @@
+See https://github.com/linux-sunxi/sunxi-boards/issues/51
+
+--- orig/sunxi-boards/sys_config/a33/a-star_kv49l.fex
++++ new/sunxi-boards/sys_config/a33/a-star_kv49l.fex
+@@ -830,25 +830,25 @@
+
+ [Vdevice]
+ Vdevice_used = 0
+-Vdevice_0 = port:P@00<0><0><0><0>
+-Vdevice_1 = port:P@00<0><0><0><0>
++;Vdevice_0 = port:P@00<0><0><0><0>
++;Vdevice_1 = port:P@00<0><0><0><0>
+
+ [s_uart0]
+ s_uart_used = 0
+-s_uart_tx = port:P@00<0><0><0><0>
+-s_uart_rx = port:P@00<0><0><0><0>
++;s_uart_tx = port:P@00<0><0><0><0>
++;s_uart_rx = port:P@00<0><0><0><0>
+
+ [s_rsb0]
+ s_rsb_used = 0
+-s_rsb_sck = port:P@00<0><0><0><0>
+-s_rsb_sda = port:P@00<0><0><0><0>
++;s_rsb_sck = port:P@00<0><0><0><0>
++;s_rsb_sda = port:P@00<0><0><0><0>
+
+ [s_jtag0]
+ s_jtag_used = 0
+-s_jtag_tms = port:P@00<0><0><0><0>
+-s_jtag_tck = port:P@00<0><0><0><0>
+-s_jtag_tdo = port:P@00<0><0><0><0>
+-s_jtag_tdi = port:P@00<0><0><0><0>
++;s_jtag_tms = port:P@00<0><0><0><0>
++;s_jtag_tck = port:P@00<0><0><0><0>
++;s_jtag_tdo = port:P@00<0><0><0><0>
++;s_jtag_tdi = port:P@00<0><0><0><0>
+
+ [s_powchk]
+ s_powchk_used = 0
+@@ -875,9 +875,9 @@
+
+ [leds_para]
+ leds_used = 0
+-;red_led = port:P@00<0><0><0><0>
+-;red_led_active_low = 0
+-;green_led_active_low = 0
+-;blue_led =
+-;blue_led_active_low = 0
++;red_led = port:P@00<0><0><0><0>
++;red_led_active_low = 0
++;green_led_active_low = 0
++;blue_led =
++;blue_led_active_low = 0
+
diff --git a/tests/test_all_fex.sh b/tests/test_all_fex.sh
new file mode 100755
index 0000000..f22325e
--- /dev/null
+++ b/tests/test_all_fex.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+FEXFILES=fexfiles.lst
+find $1 -name '*.fex' > ${FEXFILES}
+while read fex; do
+ ./fextest.sh ${fex} || exit
+done <${FEXFILES}
+rm -f ${FEXFILES}