Commit 129acd4c75f85bdb7f1267fe5f1187e0fc37d221

Authored by Simon Glass
Committed by Tom Rini
1 parent 07b342783a

test: Add a test for command repeat

This performs a command, then repeats it, and checks that the repeat
happens.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 3 changed files with 52 additions and 17 deletions Side-by-side Diff

  1 +#!/bin/sh
  2 +
  3 +# Test for U-Boot cli including command repeat
  4 +
  5 +BASE="$(dirname $0)"
  6 +. $BASE/common.sh
  7 +
  8 +run_test() {
  9 + ./${OUTPUT_DIR}/u-boot <<END
  10 +setenv ctrlc_ignore y
  11 +md 0
  12 +
  13 +reset
  14 +END
  15 +}
  16 +check_results() {
  17 + echo "Check results"
  18 +
  19 + grep -q 00000100 ${tmp} || fail "Command did not repeat"
  20 +}
  21 +
  22 +echo "Test CLI repeat"
  23 +echo
  24 +tmp="$(tempfile)"
  25 +build_uboot
  26 +run_test >${tmp}
  27 +check_results ${tmp}
  28 +rm ${tmp}
  29 +echo "Test passed"
  1 +#!/bin/sh
  2 +
  3 +OUTPUT_DIR=sandbox
  4 +
  5 +fail() {
  6 + echo "Test failed: $1"
  7 + if [ -n ${tmp} ]; then
  8 + rm ${tmp}
  9 + fi
  10 + exit 1
  11 +}
  12 +
  13 +build_uboot() {
  14 + echo "Build sandbox"
  15 + OPTS="O=${OUTPUT_DIR} $1"
  16 + NUM_CPUS=$(grep -c processor /proc/cpuinfo)
  17 + echo ${OPTS}
  18 + make ${OPTS} sandbox_config
  19 + make ${OPTS} -s -j${NUM_CPUS}
  20 +}
test/trace/test-trace.sh
... ... @@ -5,25 +5,11 @@
5 5  
6 6 # Simple test script for tracing with sandbox
7 7  
8   -OUTPUT_DIR=sandbox
9 8 TRACE_OPT="FTRACE=1"
10 9  
11   -fail() {
12   - echo "Test failed: $1"
13   - if [ -n ${tmp} ]; then
14   - rm ${tmp}
15   - fi
16   - exit 1
17   -}
  10 +BASE="$(dirname $0)/.."
  11 +. $BASE/common.sh
18 12  
19   -build_uboot() {
20   - echo "Build sandbox"
21   - OPTS="O=${OUTPUT_DIR} ${TRACE_OPT}"
22   - NUM_CPUS=$(grep -c processor /proc/cpuinfo)
23   - make ${OPTS} sandbox_config
24   - make ${OPTS} -s -j${NUM_CPUS}
25   -}
26   -
27 13 run_trace() {
28 14 echo "Run trace"
29 15 ./${OUTPUT_DIR}/u-boot <<END
... ... @@ -69,7 +55,7 @@
69 55 echo "Simple trace test / sanity check using sandbox"
70 56 echo
71 57 tmp="$(tempfile)"
72   -build_uboot
  58 +build_uboot "${TRACE_OPT}"
73 59 run_trace >${tmp}
74 60 check_results ${tmp}
75 61 rm ${tmp}