emscripten: avoid grep on binary files

This commit is contained in:
Frank Denis
2025-12-08 20:33:54 +01:00
parent 4777e59fe3
commit 3768094cee
+7 -7
View File
@@ -170,10 +170,10 @@ EOM
exit 0 exit 0
fi fi
if test "$NODE" = ""; then if test "$JS_RUNTIME" = ""; then
for candidate in bun nodejs node /usr/local/bin/bun /usr/local/bin/nodejs /usr/local/bin/node; do for candidate in bun nodejs node /usr/local/bin/bun /usr/local/bin/nodejs /usr/local/bin/node; do
if command -v $candidate >/dev/null; then if command -v $candidate >/dev/null; then
NODE=$candidate JS_RUNTIME=$candidate
break break
fi fi
done done
@@ -183,11 +183,11 @@ if [ "x$BROWSER_TESTS" != "x" ]; then
echo 'Compiling the test suite for web browsers...' && echo 'Compiling the test suite for web browsers...' &&
emmake make $MAKE_FLAGS CPPFLAGS="$CPPFLAGS -DBROWSER_TESTS=1" check >/dev/null 2>&1 emmake make $MAKE_FLAGS CPPFLAGS="$CPPFLAGS -DBROWSER_TESTS=1" check >/dev/null 2>&1
else else
if test "$NODE" = ""; then if test "$JS_RUNTIME" = ""; then
echo 'Javascript runtime not found - test suite skipped' >&2 echo 'Javascript runtime not found - test suite skipped' >&2
exit 1 exit 1
fi fi
echo "Using [${NODE}] as a Javascript runtime" echo "Using [${JS_RUNTIME}] as a Javascript runtime"
echo 'Compiling the test suite...' && echo 'Compiling the test suite...' &&
emmake make $MAKE_FLAGS check >/dev/null 2>&1 emmake make $MAKE_FLAGS check >/dev/null 2>&1
fi fi
@@ -199,7 +199,7 @@ if [ "x$BROWSER_TESTS" != "x" ]; then
mkdir -p browser && mkdir -p browser &&
rm -f browser/tests.txt && rm -f browser/tests.txt &&
for file in *.js; do for file in *.js; do
grep -Fv "#! /usr/bin/env ${NODE}" "$file" >"browser/${file}" cp "$file" "browser/${file}"
tname=$(echo "$file" | sed 's/.js$//') tname=$(echo "$file" | sed 's/.js$//')
cp -f "${tname}.exp" "browser/${tname}.exp" cp -f "${tname}.exp" "browser/${tname}.exp"
sed "s/{{tname}}/${tname}/" index.html.tpl >"browser/${tname}.html" sed "s/{{tname}}/${tname}/" index.html.tpl >"browser/${tname}.html"
@@ -212,8 +212,8 @@ else
( (
cd test/default && cd test/default &&
for file in *.js; do for file in *.js; do
echo "#! /usr/bin/env ${NODE}" >"${file}.tmp" echo "#! /usr/bin/env ${JS_RUNTIME}" >"${file}.tmp"
grep -Fv "#! /usr/bin/env ${NODE}" "$file" >>"${file}.tmp" cat "$file" >> "${file}.tmp"
chmod +x "${file}.tmp" chmod +x "${file}.tmp"
mv -f "${file}.tmp" "$file" mv -f "${file}.tmp" "$file"
done done