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): move tests from directives....



details:   https://anonhg.NetBSD.org/src/rev/c516ab39dc68
branches:  trunk
changeset: 945661:c516ab39dc68
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Nov 03 17:17:31 2020 +0000

description:
make(1): move tests from directives.mk to separate tests

diffstat:

 distrib/sets/lists/tests/mi                         |    6 +-
 usr.bin/make/unit-tests/Makefile                    |    3 +-
 usr.bin/make/unit-tests/directive-elif.exp          |   16 +-
 usr.bin/make/unit-tests/directive-elif.mk           |   58 ++++++-
 usr.bin/make/unit-tests/directive-export-env.mk     |    6 +-
 usr.bin/make/unit-tests/directive-export-literal.mk |    6 +-
 usr.bin/make/unit-tests/directive-export.exp        |    5 +-
 usr.bin/make/unit-tests/directive-export.mk         |    8 +-
 usr.bin/make/unit-tests/directive-include.exp       |    5 +-
 usr.bin/make/unit-tests/directive-include.mk        |    7 +-
 usr.bin/make/unit-tests/directive-info.exp          |   11 +-
 usr.bin/make/unit-tests/directive-info.mk           |   11 +-
 usr.bin/make/unit-tests/directive-undef.exp         |    5 +-
 usr.bin/make/unit-tests/directive-undef.mk          |    6 +-
 usr.bin/make/unit-tests/directive-unexport-env.mk   |    6 +-
 usr.bin/make/unit-tests/directive-unexport.exp      |    5 +-
 usr.bin/make/unit-tests/directive-unexport.mk       |    6 +-
 usr.bin/make/unit-tests/directive-warning.exp       |   12 +-
 usr.bin/make/unit-tests/directive-warning.mk        |   11 +-
 usr.bin/make/unit-tests/directive.exp               |    8 +-
 usr.bin/make/unit-tests/directive.mk                |   12 +-
 usr.bin/make/unit-tests/directives.exp              |   42 -----
 usr.bin/make/unit-tests/directives.mk               |  163 --------------------
 23 files changed, 189 insertions(+), 229 deletions(-)

diffs (truncated from 623 to 300 lines):

diff -r 37f646961ce3 -r c516ab39dc68 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Nov 03 15:06:50 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.959 2020/11/02 20:43:27 rillig Exp $
+# $NetBSD: mi,v 1.960 2020/11/03 17:17:31 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5059,8 +5059,8 @@
 ./usr/tests/usr.bin/make/unit-tests/directive-warning.mk                       tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive.exp                              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive.mk                               tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/directives.exp                             tests-usr.bin-tests     compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/directives.mk                              tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directives.exp                             tests-obsolete          obsolete
+./usr/tests/usr.bin/make/unit-tests/directives.mk                              tests-obsolete          obsolete
 ./usr/tests/usr.bin/make/unit-tests/dollar.exp                                 tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dollar.mk                                  tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/doterror.exp                               tests-usr.bin-tests     compattestfile,atf
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.186 2020/11/02 21:53:28 rillig Exp $
+# $NetBSD: Makefile,v 1.187 2020/11/03 17:17:31 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -159,7 +159,6 @@
 TESTS+=                directive-unexport
 TESTS+=                directive-unexport-env
 TESTS+=                directive-warning
-TESTS+=                directives
 TESTS+=                dollar
 TESTS+=                doterror
 TESTS+=                dotwait
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-elif.exp
--- a/usr.bin/make/unit-tests/directive-elif.exp        Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-elif.exp        Tue Nov 03 17:17:31 2020 +0000
@@ -1,1 +1,15 @@
-exit status 0
+make: "directive-elif.mk" line 7: begin .elif misspellings tests, part 1
+make: "directive-elif.mk" line 9: 1-then
+make: "directive-elif.mk" line 18: begin .elif misspellings tests, part 2
+make: "directive-elif.mk" line 29: begin .elif misspellings tests, part 3
+make: "directive-elif.mk" line 41: which branch is taken on misspelling after false?
+make: "directive-elif.mk" line 49: else
+make: "directive-elif.mk" line 52: which branch is taken on misspelling after true?
+make: "directive-elif.mk" line 54: 1-then
+make: "directive-elif.mk" line 55: Unknown directive "elsif"
+make: "directive-elif.mk" line 56: 1-elsif
+make: "directive-elif.mk" line 57: Unknown directive "elsif"
+make: "directive-elif.mk" line 58: 2-elsif
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-elif.mk
--- a/usr.bin/make/unit-tests/directive-elif.mk Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-elif.mk Tue Nov 03 17:17:31 2020 +0000
@@ -1,8 +1,64 @@
-# $NetBSD: directive-elif.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-elif.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .elif directive.
 
 # TODO: Implementation
 
+.info begin .elif misspellings tests, part 1
+.if 1
+.  info 1-then
+.elif 1                                # ok
+.  info 1-elif
+.elsif 1                       # oops: misspelled
+.  info 1-elsif
+.elseif 1                      # oops: misspelled
+.  info 1-elseif
+.endif
+
+.info begin .elif misspellings tests, part 2
+.if 0
+.  info 0-then
+.elif 0                                # ok
+.  info 0-elif
+.elsif 0                       # oops: misspelled
+.  info 0-elsif
+.elseif 0                      # oops: misspelled
+.  info 0-elseif
+.endif
+
+.info begin .elif misspellings tests, part 3
+.if 0
+.  info 0-then
+.elsif 0                       # oops: misspelled
+.  info 0-elsif
+.endif
+.if 0
+.  info 0-then
+.elseif 0                      # oops: misspelled
+.  info 0-elseif
+.endif
+
+.info which branch is taken on misspelling after false?
+.if 0
+.  info 0-then
+.elsif 1
+.  info 1-elsif
+.elsif 2
+.  info 2-elsif
+.else
+.  info else
+.endif
+
+.info which branch is taken on misspelling after true?
+.if 1
+.  info 1-then
+.elsif 1
+.  info 1-elsif
+.elsif 2
+.  info 2-elsif
+.else
+.  info else
+.endif
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-export-env.mk
--- a/usr.bin/make/unit-tests/directive-export-env.mk   Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-export-env.mk   Tue Nov 03 17:17:31 2020 +0000
@@ -1,8 +1,12 @@
-# $NetBSD: directive-export-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-export-env.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .export-env directive.
 
 # TODO: Implementation
 
+.export-en                     # oops: misspelled
+.export-env
+.export-environment            # oops: misspelled
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-export-literal.mk
--- a/usr.bin/make/unit-tests/directive-export-literal.mk       Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-export-literal.mk       Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export-literal.mk,v 1.5 2020/10/05 19:27:48 rillig Exp $
+# $NetBSD: directive-export-literal.mk,v 1.6 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .export-literal directive, which exports a variable value
 # without expanding it.
@@ -7,5 +7,9 @@
 
 .export-literal UT_VAR
 
+.export-litera                 # oops: misspelled
+.export-literal                        # oops: missing argument
+.export-literally              # oops: misspelled
+
 all:
        @echo "$$UT_VAR"
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-export.exp
--- a/usr.bin/make/unit-tests/directive-export.exp      Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-export.exp      Tue Nov 03 17:17:31 2020 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "directive-export.mk" line 25: Unknown directive "expor"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-export.mk
--- a/usr.bin/make/unit-tests/directive-export.mk       Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-export.mk       Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export.mk,v 1.3 2020/10/29 17:27:12 rillig Exp $
+# $NetBSD: directive-export.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .export directive.
 
@@ -21,5 +21,11 @@
 .  error
 .endif
 
+# Tests for parsing the .export directive.
+.expor                         # misspelled
+.export                                # oops: missing argument
+.export VARNAME
+.exporting works               # oops: misspelled
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-include.exp
--- a/usr.bin/make/unit-tests/directive-include.exp     Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.exp     Tue Nov 03 17:17:31 2020 +0000
@@ -2,4 +2,7 @@
 lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
 CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
 lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
-exit status 0
+make: "directive-include.mk" line 25: Could not find nonexistent.mk
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-include.mk
--- a/usr.bin/make/unit-tests/directive-include.mk      Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-include.mk      Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.3 2020/10/31 23:01:23 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .include directive, which includes another file.
 
@@ -22,5 +22,10 @@
 .  error
 .endif
 
+.include "nonexistent.mk"
+.include "/dev/null"           # size 0
+# including a directory technically succeeds, but shouldn't.
+#.include "."                  # directory
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-info.exp
--- a/usr.bin/make/unit-tests/directive-info.exp        Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-info.exp        Tue Nov 03 17:17:31 2020 +0000
@@ -1,1 +1,10 @@
-exit status 0
+make: "directive-info.mk" line 7: begin .info tests
+make: "directive-info.mk" line 8: Unknown directive "inf"
+make: "directive-info.mk" line 9: Unknown directive "info"
+make: "directive-info.mk" line 10: message
+make: "directive-info.mk" line 11: indented message
+make: "directive-info.mk" line 12: Unknown directive "information"
+make: "directive-info.mk" line 13: message
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-info.mk
--- a/usr.bin/make/unit-tests/directive-info.mk Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-info.mk Tue Nov 03 17:17:31 2020 +0000
@@ -1,8 +1,17 @@
-# $NetBSD: directive-info.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-info.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .info directive.
 
 # TODO: Implementation
 
+.info begin .info tests
+.inf                           # misspelled
+.info                          # oops: message should be "missing parameter"
+.info message
+.info          indented message
+.information
+.information message           # oops: misspelled
+.info.man:                     # not a message, but possibly a suffix rule
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-undef.exp
--- a/usr.bin/make/unit-tests/directive-undef.exp       Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-undef.exp       Tue Nov 03 17:17:31 2020 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "directive-undef.mk" line 16: Unknown directive "unde"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-undef.mk
--- a/usr.bin/make/unit-tests/directive-undef.mk        Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-undef.mk        Tue Nov 03 17:17:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-undef.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.5 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .undef directive.
 
@@ -13,5 +13,9 @@
 .  warning $1$2$3
 .endif
 
+.unde                          # misspelled
+.undef                         # oops: missing argument
+.undefined                     # oops: misspelled
+
 all:
        @:;
diff -r 37f646961ce3 -r c516ab39dc68 usr.bin/make/unit-tests/directive-unexport-env.mk
--- a/usr.bin/make/unit-tests/directive-unexport-env.mk Tue Nov 03 15:06:50 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-unexport-env.mk Tue Nov 03 17:17:31 2020 +0000
@@ -1,8 +1,12 @@
-# $NetBSD: directive-unexport-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-unexport-env.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
 #
 # Tests for the .unexport-env directive.
 
 # TODO: Implementation
 



Home | Main Index | Thread Index | Old Index