Convert [ ... ] to test ... in scripting.

The "[" link may be missing during OS boostrapping.

* build.sh: Convert "[ ... ]" to "test ..."
* maintMakefile: Ditto.
* scripts/copyright-update: Ditto
* tests/scripts/features/reinvoke: Ditto
* tests/scripts/features/targetvars: Ditto
This commit is contained in:
Paul Smith 2020-05-03 13:39:55 -04:00
parent a015d1f822
commit c8a6263eb5
5 changed files with 16 additions and 16 deletions

View file

@ -103,7 +103,7 @@ convert ()
esac esac
fn="$top_srcdir/lib/${fn##*/}" fn="$top_srcdir/lib/${fn##*/}"
[ -f "$fn" ] || { echo "Missing file: $fn"; exit 1; } test -f "$fn" || { echo "Missing file: $fn"; exit 1; }
sed "/definitions* of $inc/r $fn" "$int" > "${int}_" sed "/definitions* of $inc/r $fn" "$int" > "${int}_"
int=${int}_ int=${int}_

View file

@ -140,7 +140,7 @@ ChangeLog: .check-git-HEAD
.PHONY: .check-git-HEAD .PHONY: .check-git-HEAD
.check-git-HEAD: .check-git-HEAD:
sha="`git rev-parse HEAD`"; \ sha="`git rev-parse HEAD`"; \
[ -f '$@' ] && [ "`cat '$@' 2>/dev/null`" = "$$sha" ] \ test -f '$@' && [ "`cat '$@' 2>/dev/null`" = "$$sha" ] \
|| echo "$$sha" > '$@' || echo "$$sha" > '$@'
@ -187,7 +187,7 @@ do-po-update:
$(MAKE) po-check $(MAKE) po-check
po-update: po-update:
[ -d "po" ] && $(MAKE) do-po-update test -d "po" && $(MAKE) do-po-update
# -------------------------- # # -------------------------- #
# Updating GNU build files. # # Updating GNU build files. #
@ -385,16 +385,16 @@ gnuweb-dir = www/server/standards
# Get the GNU make web page boilerplate etc. # Get the GNU make web page boilerplate etc.
update-makeweb: update-makeweb:
[ -d '$(MAKEWEBDIR)' ] || mkdir -p '$(MAKEWEBDIR)' test -d '$(MAKEWEBDIR)' || mkdir -p '$(MAKEWEBDIR)'
[ -d '$(MAKEWEBDIR)'/CVS ] \ test -d '$(MAKEWEBDIR)'/CVS \
&& { cd '$(MAKEWEBDIR)' && $(CVS) update; } \ && { cd '$(MAKEWEBDIR)' && $(CVS) update; } \
|| { mkdir -p '$(dir $(MAKEWEBDIR))' && cd '$(dir $(MAKEWEBDIR))' \ || { mkdir -p '$(dir $(MAKEWEBDIR))' && cd '$(dir $(MAKEWEBDIR))' \
&& $(CVS) -d $(makeweb-repo) co -d '$(notdir $(MAKEWEBDIR))' make; } && $(CVS) -d $(makeweb-repo) co -d '$(notdir $(MAKEWEBDIR))' make; }
# Get the GNU web page boilerplate etc. # Get the GNU web page boilerplate etc.
update-gnuweb: update-gnuweb:
[ -d '$(GNUWEBDIR)' ] || mkdir -p '$(GNUWEBDIR)' test -d '$(GNUWEBDIR)' || mkdir -p '$(GNUWEBDIR)'
[ -d '$(GNUWEBDIR)/$(gnuweb-dir)'/CVS ] \ test -d '$(GNUWEBDIR)/$(gnuweb-dir)'/CVS \
&& { cd '$(GNUWEBDIR)/$(gnuweb-dir)' && $(CVS) update; } \ && { cd '$(GNUWEBDIR)/$(gnuweb-dir)' && $(CVS) update; } \
|| { cd '$(GNUWEBDIR)' && $(CVS) -d $(gnuweb-repo) co '$(gnuweb-dir)'; } || { cd '$(GNUWEBDIR)' && $(CVS) -d $(gnuweb-repo) co '$(gnuweb-dir)'; }
@ -446,8 +446,8 @@ $(COV_BUILD_FILE): $(filter %.c %.h,$(DISTFILES))
cov-submit: $(COV_BUILD_FILE)-submitted cov-submit: $(COV_BUILD_FILE)-submitted
$(COV_BUILD_FILE)-submitted: $(COV_BUILD_FILE) $(COV_BUILD_FILE)-submitted: $(COV_BUILD_FILE)
@[ -n "$(COVERITY_TOKEN)" ] || { echo 'COVERITY_TOKEN not set'; exit 1; } @test -n "$(COVERITY_TOKEN)" || { echo 'COVERITY_TOKEN not set'; exit 1; }
@[ -n "$(COVERITY_EMAIL)" ] || { echo 'COVERITY_EMAIL not set'; exit 1; } @test -n "$(COVERITY_EMAIL)" || { echo 'COVERITY_EMAIL not set'; exit 1; }
rm -f '$@' rm -f '$@'
case '$(VERSION)' in \ case '$(VERSION)' in \
(*.*.9*) type="daily build"; ext=".$$(date +%Y%m%d)" ;; \ (*.*.9*) type="daily build"; ext=".$$(date +%Y%m%d)" ;; \

View file

@ -17,7 +17,7 @@ getfiles () {
run () { run () {
cmd=$(command -v "$update") || die "Cannot locate update-copyright ($update)" cmd=$(command -v "$update") || die "Cannot locate update-copyright ($update)"
[ -x "$cmd" ] || die "Cannot locate update-copyright ($update)" test -x "$cmd" || die "Cannot locate update-copyright ($update)"
force=false force=false
@ -30,9 +30,9 @@ run () {
if $force; then if $force; then
: just do it : just do it
elif [ ! -f src/makeint.h ]; then elif test ! -f src/makeint.h; then
die "Run in the root of the GNU make workspace" die "Run in the root of the GNU make workspace"
elif [ -f configure ]; then elif test -f configure; then
die "Run in a clean workspace (git clean -fdX)" die "Run in a clean workspace (git clean -fdX)"
fi fi

View file

@ -45,17 +45,17 @@ all: ; @echo hello
a : b ; echo >> $@ a : b ; echo >> $@
b : c ; [ -f $@ ] || echo >> $@ b : c ; test -f $@ || echo >> $@
c: ; echo >> $@ c: ; echo >> $@
include $(F)', include $(F)',
'F=a', "[ -f b ] || echo >> b\nhello\n"); 'F=a', "test -f b || echo >> b\nhello\n");
# Now try with the file we're not updating being the actual file we're # Now try with the file we're not updating being the actual file we're
# including: this and the previous one test different parts of the code. # including: this and the previous one test different parts of the code.
run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n"); run_make_test(undef, 'F=b', "test -f b || echo >> b\nhello\n");
&rmfiles('a','b','c'); &rmfiles('a','b','c');

View file

@ -183,7 +183,7 @@ run_make_test(undef, 'foo PATTERN=yes', "ok ok foo pat\nok ok foo pat\n");
# (> make default buffer length) # (> make default buffer length)
run_make_test(' run_make_test('
base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if [ -f "build_information.generate" ]; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi ) base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if test -f "build_information.generate" ; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi )
deals_changed_since: ; @echo $(BUILD_OBJ) deals_changed_since: ; @echo $(BUILD_OBJ)
', ',