Reactivate the tracing feature
PATCH v2 1/4 Reactivate the tracing feature
This was lost sometime in the Kbuild conversion. Add it back.
Check that the trace test now passes:
$ ./test/trace/test-trace.sh Simple trace test / sanity check using sandbox
/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN /home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed
---
Changes in v2: None
config.mk | 4 ++++ 1 file changed, 4 insertions(+)
config.mk +4 -0
@@ -53,6 +53,10 @@ ifdef BOARD sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules endif +ifdef FTRACE +PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE +endif + ######################################################################### RELFLAGS := $(PLATFORM_RELFLAGS)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 2/4 sandbox: Disable Ctrl-C
This is not supported properly on sandbox, and interferes with running tests, since when a test script is piped in, some commands will call ctrlc() which will drop characters from the test script.
---
Changes in v2:
- Remove more elaborate feature and just disable ctrlc for sandbox
common/console.c | 3 +++ 1 file changed, 3 insertions(+)
common/console.c +3 -0
@@ -524,6 +524,7 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */static int ctrlc_was_pressed =0 ;int ctrlc (void ) { +#ifndef CONFIG_SANDBOX if (!ctrlc_disabled && gd->have_console) {if (tstc ()) {switch (getc ()) {
@@ -535,6 +536,8 @@ int ctrlc(void) } } } +#endif +return 0 ; }/* Reads user's confirmation.
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 2/4 sandbox: Disable Ctrl-C
Quoted 5 lines · Simon Glass
This is not supported properly on sandbox, and interferes with running tests, since when a test script is piped in, some commands will call
ctrlc()which will drop characters from the test script.Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/26a6c660/attachment.pgp>
PATCH v2 3/4 test: Remove tabs from trace test
In reply to Simon GlassThese cause U-Boot to print a list of available commands. It doesn't break the test, but it is best to remove them from the output.
---
Changes in v2: None
test/trace/test-trace.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
test/trace/test-trace.sh +11 -11
@@ -27,17 +27,17 @@ build_uboot() { run_trace() { echo "Run trace" ./${OUTPUT_DIR}/u-boot <<END - trace stats - hash sha256 0 10000 - trace pause - trace stats - hash sha256 0 10000 - trace stats - trace resume - hash sha256 0 10000 - trace pause - trace stats - reset +trace stats +hash sha256 0 10000 +trace pause +trace stats +hash sha256 0 10000 +trace stats +trace resume +hash sha256 0 10000 +trace pause +trace stats +reset END }
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 3/4 test: Remove tabs from trace test
Quoted 4 lines · Simon Glass
These cause U-Boot to print a list of available commands. It doesn't break the test, but it is best to remove them from the output.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/46168498/attachment.pgp>
PATCH v2 4/4 test: Add a test for command repeat
In reply to Simon GlassThis performs a command, then repeats it, and checks that the repeat happens.
---
Changes in v2: None
test/cmd_repeat.sh | 29 +++++++++++++++++++++++++++++ test/common.sh | 20 ++++++++++++++++++++ test/trace/test-trace.sh | 20 +++----------------- 3 files changed, 52 insertions(+), 17 deletions(-) create mode 100755 test/cmd_repeat.sh create mode 100644 test/common.sh
test/cmd_repeat.sh new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/sh + +# Test for U-Boot cli including command repeat + +BASE="$(dirname $0)" +. $BASE/common.sh + +run_test() { + ./${OUTPUT_DIR}/u-boot <<END +setenv ctrlc_ignore y +md 0 + +reset +END +} +check_results() { + echo "Check results" + + grep -q 00000100 ${tmp} || fail "Command did not repeat" +} + +echo "Test CLI repeat" +echo +tmp="$(tempfile)" +build_uboot +run_test >${tmp} +check_results ${tmp} +rm ${tmp} +echo "Test passed"
test/common.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh + +OUTPUT_DIR=sandbox + +fail() { + echo "Test failed: $1" + if [ -n ${tmp} ]; then + rm ${tmp} + fi + exit 1 +} + +build_uboot() { + echo "Build sandbox" + OPTS="O=${OUTPUT_DIR} $1" + NUM_CPUS=$(grep -c processor /proc/cpuinfo) + echo ${OPTS} + make ${OPTS} sandbox_config + make ${OPTS} -s -j${NUM_CPUS} +}
test/trace/test-trace.sh +3 -17
@@ -5,24 +5,10 @@ # Simple test script for tracing with sandbox -OUTPUT_DIR=sandbox TRACE_OPT="FTRACE=1" -fail() { - echo "Test failed: $1" - if [ -n ${tmp} ]; then - rm ${tmp} - fi - exit 1 -} - -build_uboot() { - echo "Build sandbox" - OPTS="O=${OUTPUT_DIR} ${TRACE_OPT}" - NUM_CPUS=$(grep -c processor /proc/cpuinfo) - make ${OPTS} sandbox_config - make ${OPTS} -s -j${NUM_CPUS} -} +BASE="$(dirname $0)/.." +. $BASE/common.sh run_trace() { echo "Run trace"
@@ -69,7 +55,7 @@ check_results() { echo "Simple trace test / sanity check using sandbox" echo tmp="$(tempfile)" -build_uboot +build_uboot "${TRACE_OPT}" run_trace >${tmp} check_results ${tmp} rm ${tmp}
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH v2 4/4 test: Add a test for command repeat
Quoted 4 lines · Simon Glass
This performs a command, then repeats it, and checks that the repeat happens.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/f3d7096a/attachment.pgp>
PATCH v2 1/4 Reactivate the tracing feature
In reply to Simon GlassQuoted 15 lines · Simon Glass
This was lost sometime in the
Kbuildconversion. Add it back.Check that the trace test now passes:
$ ./test/trace/test-trace.sh Simple trace test / sanity check using sandbox
/tmp/filemHKPGw
Build sandbox
O=sandbox FTRACE=1
GEN/home/sjg/c/src/third_party/u-boot/files/sandbox/Makefile
Configuring for sandbox board...
Check results
Test passed
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140925/3bf8bc1c/attachment.pgp>