Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for edge cases in...
details: https://anonhg.NetBSD.org/src/rev/a47c1ae8fd24
branches: trunk
changeset: 946040:a47c1ae8fd24
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 14 17:33:51 2020 +0000
description:
make(1): add tests for edge cases in parsing the command line
diffstat:
usr.bin/make/unit-tests/opt.exp | 18 ++++++++++++++++++
usr.bin/make/unit-tests/opt.mk | 22 +++++++++++++++++++---
2 files changed, 37 insertions(+), 3 deletions(-)
diffs (54 lines):
diff -r 29d80f467a7b -r a47c1ae8fd24 usr.bin/make/unit-tests/opt.exp
--- a/usr.bin/make/unit-tests/opt.exp Sat Nov 14 17:29:41 2020 +0000
+++ b/usr.bin/make/unit-tests/opt.exp Sat Nov 14 17:33:51 2020 +0000
@@ -1,1 +1,19 @@
+make -:
+usage: make [-BeikNnqrstWwX]
+ [-C directory] [-D variable] [-d flags] [-f makefile]
+ [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]
+ [-V variable] [-v variable] [variable=value] [target ...]
+*** Error code 2 (ignored)
+
+make -- -VAR=value -f /dev/null
+make: don't know how to make -f (continuing)
+`/dev/null' is up to date.
+
+make -?
+usage: make [-BeikNnqrstWwX]
+ [-C directory] [-D variable] [-d flags] [-f makefile]
+ [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]
+ [-V variable] [-v variable] [variable=value] [target ...]
+*** Error code 2 (ignored)
+
exit status 0
diff -r 29d80f467a7b -r a47c1ae8fd24 usr.bin/make/unit-tests/opt.mk
--- a/usr.bin/make/unit-tests/opt.mk Sat Nov 14 17:29:41 2020 +0000
+++ b/usr.bin/make/unit-tests/opt.mk Sat Nov 14 17:33:51 2020 +0000
@@ -1,8 +1,24 @@
-# $NetBSD: opt.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt.mk,v 1.3 2020/11/14 17:33:51 rillig Exp $
#
# Tests for the command line options.
# TODO: Implementation
-all:
- @:;
+.MAKEFLAGS: -d0 # make stdout line-buffered
+
+all: .IGNORE
+ # Just to see how the custom argument parsing code reacts to a syntax
+ # error. The colon is used in the options string, marking an option
+ # that takes arguments. It is not an option by itself, though.
+ ${MAKE} -:
+ @echo
+
+ # See whether a '--' stops handling of command line options, like in
+ # standard getopt programs. Yes, it does, and it treats the '-f' as
+ # a target to be created.
+ ${MAKE} -- -VAR=value -f /dev/null
+ @echo
+
+ # This is the normal way to print the usage of a command.
+ ${MAKE} -?
+ @echo
Home |
Main Index |
Thread Index |
Old Index