From a21d14fbd204c05975f715f48ff02f9de8deffb5 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 13 May 2022 10:31:27 -0700 Subject: [PATCH] format shell scripts per style guide --- src/script_opt/CPP/maint/README | 4 ++++ src/script_opt/CPP/maint/check-CPP-gen.sh | 8 +++++--- src/script_opt/CPP/maint/check-zeek.sh | 2 +- src/script_opt/CPP/maint/do-CPP-btest.sh | 21 +++++++++++++++------ src/script_opt/CPP/maint/find-test-files.sh | 6 +++--- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/script_opt/CPP/maint/README b/src/script_opt/CPP/maint/README index d7ca841e80..27b86cf65b 100644 --- a/src/script_opt/CPP/maint/README +++ b/src/script_opt/CPP/maint/README @@ -3,6 +3,10 @@ This is a collection of scripts to support maintenance of -O gen-C++ suite, and are currently tailored for the lead maintainer's own environment. The scripts all assume you're running them from build/ . +If you make changes to the scripts, format them using + + shfmt -w -i 4 -ci *.sh + The maintenance workflow: 1. Update this timestamp, so this file will be changed and you'll remember diff --git a/src/script_opt/CPP/maint/check-CPP-gen.sh b/src/script_opt/CPP/maint/check-CPP-gen.sh index 3b72e5f14b..e8c56fbf91 100644 --- a/src/script_opt/CPP/maint/check-CPP-gen.sh +++ b/src/script_opt/CPP/maint/check-CPP-gen.sh @@ -1,6 +1,8 @@ #! /bin/sh -out=out.`echo $1 | sed 's,\.\./,,;s,/,#,g'` +out=out.$(echo $1 | sed 's,\.\./,,;s,/,#,g') -(/bin/echo -n $1" " -(src/zeek -O gen-C++ --optimize-files=testing/btest --optimize-func="" $1 >& /dev/null && echo "success") || echo "fail") >CPP-test/$out 2>&1 +( + /bin/echo -n $1" " + (src/zeek -O gen-C++ --optimize-files=testing/btest --optimize-func="" $1 >&/dev/null && echo "success") || echo "fail" +) >CPP-test/$out 2>&1 diff --git a/src/script_opt/CPP/maint/check-zeek.sh b/src/script_opt/CPP/maint/check-zeek.sh index 4bcbe544c7..a61bd7ecb0 100644 --- a/src/script_opt/CPP/maint/check-zeek.sh +++ b/src/script_opt/CPP/maint/check-zeek.sh @@ -1,4 +1,4 @@ #! /bin/sh /bin/echo -n $1" " -(src/zeek --parse-only $1 >& /dev/null && echo "success") || echo "fail" +(src/zeek --parse-only $1 >&/dev/null && echo "success") || echo "fail" diff --git a/src/script_opt/CPP/maint/do-CPP-btest.sh b/src/script_opt/CPP/maint/do-CPP-btest.sh index 0648016347..3146db4997 100644 --- a/src/script_opt/CPP/maint/do-CPP-btest.sh +++ b/src/script_opt/CPP/maint/do-CPP-btest.sh @@ -1,21 +1,30 @@ #! /bin/sh rm -f CPP-gen.cc -cp zeek.HOLD src/zeek || (echo Need to create clean zeek.HOLD; exit 1) || exit 1 +cp zeek.HOLD src/zeek || ( + echo Need to create clean zeek.HOLD + exit 1 +) || exit 1 -base=`echo $1 | sed 's,\.\./,,;s,/,#,g'` -rel_test=`echo $1 | sed 's,.*testing/btest/,,'` +base=$(echo $1 | sed 's,\.\./,,;s,/,#,g') +rel_test=$(echo $1 | sed 's,.*testing/btest/,,') export ZEEK_GEN_CPP=1 -export ZEEK_CPP_DIR=`pwd` +export ZEEK_CPP_DIR=$(pwd) # export ZEEK_OPT_FUNCS="" export ZEEK_OPT_FILES="testing/btest" -(cd ../testing/btest; ../../auxil/btest/btest $rel_test) +( + cd ../testing/btest + ../../auxil/btest/btest $rel_test +) # export -n ZEEK_GEN_CPP ZEEK_CPP_DIR ZEEK_OPT_FUNCS ZEEK_OPT_FILES export -n ZEEK_GEN_CPP ZEEK_CPP_DIR ZEEK_OPT_FILES ninja -(cd ../testing/btest; ../../auxil/btest/btest -a cpp -d -f ../../build/CPP-test/diag.$base $rel_test) +( + cd ../testing/btest + ../../auxil/btest/btest -a cpp -d -f ../../build/CPP-test/diag.$base $rel_test +) diff --git a/src/script_opt/CPP/maint/find-test-files.sh b/src/script_opt/CPP/maint/find-test-files.sh index 9d420758ed..1e35288517 100644 --- a/src/script_opt/CPP/maint/find-test-files.sh +++ b/src/script_opt/CPP/maint/find-test-files.sh @@ -1,6 +1,6 @@ #! /bin/sh find ../testing/btest -type f | -egrep -v 'Baseline|\.tmp' | -egrep '\.(zeek|test)$' | -sort + egrep -v 'Baseline|\.tmp' | + egrep '\.(zeek|test)$' | + sort