Skip to contentSkip to conversation

Reactivate the tracing feature

PATCH New Simon Glass 2 participants 8 messages Sep 14, 2014 – Sep 25, 2014

lore
Share & tools
lore
#0 lore raw

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
index b4bf6f9..2157537 100644
@@ -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
#1 lore raw

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
index 898da39..5a2f411 100644
@@ -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
#2 lore raw

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.

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>
#3 lore raw

PATCH v2 3/4 test: Remove tabs from trace test

In reply to 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.

---

Changes in v2: None

 test/trace/test-trace.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
test/trace/test-trace.sh +11 -11
index aa02f09..973063c 100755
@@ -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
#4 lore raw

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.

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>
#5 lore raw

PATCH v2 4/4 test: Add a test for command repeat

In reply to Simon Glass

This 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
new file mode 100755
index 0000000..990e799
@@ -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
new file mode 100644
index 0000000..702d1ed
@@ -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
index 973063c..3e8651e 100755
@@ -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
#6 lore raw

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.

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>
#7 lore raw

PATCH v2 1/4 Reactivate the tracing feature

In reply to Simon Glass
Quoted 15 lines · Simon Glass

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

Quoted 1 line

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>