8000 Merge pull request #2461 from jwpconsulting/env-user-variable · AFLplusplus/AFLplusplus@d25efff · GitHub
[go: up one dir, main page]

Skip to content

Commit d25efff

Browse files
Merge pull request #2461 from jwpconsulting/env-user-variable
Let user pass their own CPU_TARGET in test-pre.sh
2 parents a9900f0 + 91974bf commit d25efff

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/test-pre.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ test -z "" 2>/dev/null || { echo Error: test command not found ; exit 1 ; }
1717
GREP=`type grep > /dev/null 2>&1 && echo OK`
1818
test "$GREP" = OK || { echo Error: grep command not found ; exit 1 ; }
1919
echo foobar | grep -qE 'asd|oob' 2>/dev/null || { echo Error: grep command does not support -q and/or -E option ; exit 1 ; }
20-
test -e ./test-all.sh || cd $(dirname $0) || exit 1
20+
test -e ./test-all.sh || cd $(dirname "$0") || exit 1
2121
test -e ./test-all.sh || { echo Error: you must be in the test/ directory ; exit 1 ; }
22-
export AFL_PATH=`pwd`/..
22+
export AFL_PATH="$(pwd)/.."
2323
export AFL_TRY_AFFINITY=1 # workaround for travis that fails for no avail cores
2424

2525
echo 1 > test.1
@@ -59,7 +59,7 @@ $ECHO \\101 2>&1 | grep -qE '^A' || {
5959
$ECHO "\\101" 2>&1 | grep -qE '^A' || ECHO=
6060
}
6161
}
62-
test -z "$ECHO" && { printf Error: printf command does not support octal character codes ; exit 1 ; }
62+
test -z "$ECHO" && { echo Error: printf command does not support octal character codes ; exit 1 ; }
6363

6464
export AFL_EXIT_WHEN_DONE=1
6565
export AFL_EXIT_ON_TIME=60
@@ -109,19 +109,24 @@ test -n "$TRAVIS_OS_NAME" && {
109109

110110
# on OpenBSD we need to work with llvm from /usr/local/bin
111111
test -e /usr/local/bin/opt && {
112-
test `uname -s` = 'Darwin' || export PATH="/usr/local/bin:${PATH}"
112+
test "$(uname -s)" = 'Darwin' || export PATH="/usr/local/bin:${PATH}"
113113
}
114114
AFL_COMPILER=afl-clang-fast
115115

116-
SYS=`uname -m`
117-
118116
GREY="\\033[1;90m"
119117
BLUE="\\033[1;94m"
120118
GREEN="\\033[0;32m"
121119
RED="\\033[0;31m"
122120
YELLOW="\\033[1;93m"
123121
RESET="\\033[0m"
124122

123+
if test -n "$CPU_TARGET"; then
124+
$ECHO "${RESET}${GREY}[*] Using environment variable CPU_TARGET=$CPU_TARGET for SYS"
125+
SYS="$CPU_TARGET"
126+
else
127+
SYS=$(uname -m)
128+
fi
129+
125130
MEM_LIMIT=none
126131

127132
export PATH="${PATH}:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

0 commit comments

Comments
 (0)
0