Sun Aug 16 20:13:10 2020 UTC ()
make(1): move tests for the :O and :Or modifiers into separate files


(rillig)
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/modorder.exp
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-order-reverse.mk
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-order.mk
diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/modorder.mk

cvs diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/Attic/modorder.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/Attic/modorder.exp 2020/06/09 01:48:17 1.2
+++ src/usr.bin/make/unit-tests/Attic/modorder.exp 2020/08/16 20:13:10 1.3
@@ -1,12 +1,9 @@ @@ -1,12 +1,9 @@
1LIST = one two three four five six seven eight nine ten 
2LIST:O = eight five four nine one seven six ten three two 
3LIST:Or = two three ten six seven one nine four five eight 
4LIST:Ox = Ok 1LIST:Ox = Ok
5LIST:O:Ox = Ok 2LIST:O:Ox = Ok
6LISTX = Ok 3LISTX = Ok
7LISTSX = Ok 4LISTSX = Ok
8make: Bad modifier `:OX' for LIST 5make: Bad modifier `:OX' for LIST
9BADMOD 1 = } 6BADMOD 1 = }
10make: Bad modifier `:OxXX' for LIST 7make: Bad modifier `:OxXX' for LIST
11BADMOD 2 = XX} 8BADMOD 2 = XX}
12exit status 0 9exit status 0

cvs diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-order-reverse.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmod-order-reverse.mk 2020/08/16 14:25:16 1.2
+++ src/usr.bin/make/unit-tests/varmod-order-reverse.mk 2020/08/16 20:13:10 1.3
@@ -1,9 +1,13 @@ @@ -1,9 +1,13 @@
1# $NetBSD: varmod-order-reverse.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ 1# $NetBSD: varmod-order-reverse.mk,v 1.3 2020/08/16 20:13:10 rillig Exp $
2# 2#
3# Tests for the :Or variable modifier, which returns the words, sorted in 3# Tests for the :Or variable modifier, which returns the words, sorted in
4# descending order. 4# descending order.
5 5
6# TODO: Implementation 6NUMBERS= one two three four five six seven eight nine ten
 7
 8.if ${NUMBERS:Or} != "two three ten six seven one nine four five eight"
 9.error ${NUMBERS:Or}
 10.endif
7 11
8all: 12all:
9 @:; 13 @:;

cvs diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-order.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmod-order.mk 2020/08/16 14:25:16 1.2
+++ src/usr.bin/make/unit-tests/varmod-order.mk 2020/08/16 20:13:10 1.3
@@ -1,9 +1,13 @@ @@ -1,9 +1,13 @@
1# $NetBSD: varmod-order.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ 1# $NetBSD: varmod-order.mk,v 1.3 2020/08/16 20:13:10 rillig Exp $
2# 2#
3# Tests for the :Or variable modifier, which returns the words, sorted in 3# Tests for the :O variable modifier, which returns the words, sorted in
4# ascending order. 4# ascending order.
5 5
6# TODO: Implementation 6NUMBERS= one two three four five six seven eight nine ten
 7
 8.if ${NUMBERS:O} != "eight five four nine one seven six ten three two"
 9.error ${NUMBERS:O}
 10.endif
7 11
8all: 12all:
9 @:; 13 @:;

cvs diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/Attic/modorder.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/Attic/modorder.mk 2020/06/09 01:48:17 1.3
+++ src/usr.bin/make/unit-tests/Attic/modorder.mk 2020/08/16 20:13:10 1.4
@@ -1,24 +1,21 @@ @@ -1,24 +1,21 @@
1# $NetBSD: modorder.mk,v 1.3 2020/06/09 01:48:17 sjg Exp $ 1# $NetBSD: modorder.mk,v 1.4 2020/08/16 20:13:10 rillig Exp $
2 2
3LIST= one two three four five six seven eight nine ten 3LIST= one two three four five six seven eight nine ten
4LISTX= ${LIST:Ox} 4LISTX= ${LIST:Ox}
5LISTSX:= ${LIST:Ox} 5LISTSX:= ${LIST:Ox}
6TEST_RESULT= && echo Ok || echo Failed 6TEST_RESULT= && echo Ok || echo Failed
7 7
8# unit-tests have to produce the same results on each run 8# unit-tests have to produce the same results on each run
9# so we cannot actually include :Ox output. 9# so we cannot actually include :Ox output.
10all: 10all:
11 @echo "LIST = ${LIST}" 
12 @echo "LIST:O = ${LIST:O}" 
13 @echo "LIST:Or = ${LIST:Or}" 
14 # Note that 1 in every 10! trials two independently generated 11 # Note that 1 in every 10! trials two independently generated
15 # randomized orderings will be the same. The test framework doesn't 12 # randomized orderings will be the same. The test framework doesn't
16 # support checking probabilistic output, so we accept that each of the 13 # support checking probabilistic output, so we accept that each of the
17 # 3 :Ox tests will incorrectly fail with probability 2.756E-7, which 14 # 3 :Ox tests will incorrectly fail with probability 2.756E-7, which
18 # lets the whole test fail once in 1.209.600 runs, on average. 15 # lets the whole test fail once in 1.209.600 runs, on average.
19 @echo "LIST:Ox = `test '${LIST:Ox}' != '${LIST:Ox}' ${TEST_RESULT}`" 16 @echo "LIST:Ox = `test '${LIST:Ox}' != '${LIST:Ox}' ${TEST_RESULT}`"
20 @echo "LIST:O:Ox = `test '${LIST:O:Ox}' != '${LIST:O:Ox}' ${TEST_RESULT}`" 17 @echo "LIST:O:Ox = `test '${LIST:O:Ox}' != '${LIST:O:Ox}' ${TEST_RESULT}`"
21 @echo "LISTX = `test '${LISTX}' != '${LISTX}' ${TEST_RESULT}`" 18 @echo "LISTX = `test '${LISTX}' != '${LISTX}' ${TEST_RESULT}`"
22 @echo "LISTSX = `test '${LISTSX}' = '${LISTSX}' ${TEST_RESULT}`" 19 @echo "LISTSX = `test '${LISTSX}' = '${LISTSX}' ${TEST_RESULT}`"
23 @echo "BADMOD 1 = ${LIST:OX}" 20 @echo "BADMOD 1 = ${LIST:OX}"
24 @echo "BADMOD 2 = ${LIST:OxXX}" 21 @echo "BADMOD 2 = ${LIST:OxXX}"