Fix the test suite so that individual *.tests files can be run ala
COMMAND=sort ./sort.tests So we can compare against non-busybox versions, and possibly our testsuite will be useful to somebody like the Linux Test Project someday. Redid testing.sh to add new command, "optional", to skip tests that require certain features. (use: `optional FEATURE_SORT_BIG`, or `optional ""` to stop skipping.) Note that optional is a NOP if the environment variable "OPTIONFLAGS" is blank, so although we're marking up the tests with busybox specific knowledge, it doesn't interfere with running the tests without busybox. Moved setting the "OPTIONFLAGS" environment variable to runtest. Philosophy: busybox-specific stuff belongs in runtest; both testing.sh and the tests themselves should be as busybox-agnostic as possible. Moved detecting that a command isn't in busybox at all (hence skipping the entire command.tests file) to runtests. Rationale: optional can't currently test for more than one feature at a time, so if we clear anything with optional "" we might perform tests we don't want to. Marked up busybox.tests to know which tests need CAT enabled. Fixed up other tests to be happy with new notation. I suspect egrep should be appended to grep. It's a sub-feature, really...
This commit is contained in:
@@ -9,9 +9,6 @@
|
||||
[ ${#COMMAND} -eq 0 ] && COMMAND=grep
|
||||
. testing.sh
|
||||
|
||||
# Depends on grep
|
||||
_BB_CONFIG_DEP=grep
|
||||
|
||||
# testing "test name" "options" "expected result" "file input" "stdin"
|
||||
# file input will be file called "input"
|
||||
# test can create a file "actual" instead of writing to stdout
|
||||
@@ -75,8 +72,7 @@ testing "grep matches NUL" ". input > /dev/null 2>&1 ; echo \$?" "0\n" "\0\n" ""
|
||||
testing "grep handles multiple regexps" "-e one -e two input ; echo \$?" \
|
||||
"one\ntwo\n0\n" "one\ntwo\n" ""
|
||||
|
||||
# Depends on FEATURE_GREP_EGREP_ALIAS
|
||||
_BB_CONFIG_DEP=FEATURE_GREP_EGREP_ALIAS
|
||||
optional FEATURE_GREP_EGREP_ALIAS
|
||||
testing "grep -E supports extended regexps" "-E fo+" "foo\n" "" "b\ar\nfoo\nbaz"
|
||||
|
||||
exit $FAILCOUNT
|
||||
|
Reference in New Issue
Block a user