diff options
author | David Sterba <dsterba@suse.com> | 2016-06-22 14:07:46 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-06-22 14:07:46 +0200 |
commit | ac1e484a0a5e575e32df68745e1214cbe7b95daa (patch) | |
tree | 67dcfe1a89fc316fe2cbc42c8b0b5ff74dbc41bb /tests | |
parent | 329ff544a4ce36c9f9910402646f4d286696d3e4 (diff) |
btrfs-progs: tests: add test console
Add a wrapper that sets up environment the same way a test would use it.
Use it for quick prototyping or testing, the commands and output is
logged.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test-console.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test-console.sh b/tests/test-console.sh new file mode 100755 index 00000000..cc1cdf3c --- /dev/null +++ b/tests/test-console.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# a shell with test environment set up, logged commands and output + +LANG=C +SCRIPT_DIR=$(dirname $(readlink -f $0)) +TOP=$(readlink -f $SCRIPT_DIR/../) +TEST_DEV=${TEST_DEV:-} +RESULTS="$TOP/tests/test-console.txt" +IMAGE="$TOP/tests/test.img" + +source common +source common.convert + +setup_root_helper + +echo "Eval loop in test environment (log: $RESULTS)" +echo -e " ---------------------\nStarting session, `date`" >> "$RESULTS" +echo -n "`pwd`> " +while read x; do + echo "COMMAND: $x" >> "$RESULTS" + { eval $x; } 2>&1 | tee -a "$RESULTS" + echo -n "`pwd`> " +done |