1e6d6c189SCody Peter Mello#
2e6d6c189SCody Peter Mello# This file and its contents are supplied under the terms of the
3e6d6c189SCody Peter Mello# Common Development and Distribution License ("CDDL"), version 1.0.
4e6d6c189SCody Peter Mello# You may only use this file in accordance with the terms of version
5e6d6c189SCody Peter Mello# 1.0 of the CDDL.
6e6d6c189SCody Peter Mello#
7e6d6c189SCody Peter Mello# A full copy of the text of the CDDL should have accompanied this
8e6d6c189SCody Peter Mello# source.  A copy of the CDDL is also available via the Internet at
9e6d6c189SCody Peter Mello# http://www.illumos.org/license/CDDL.
10e6d6c189SCody Peter Mello#
11e6d6c189SCody Peter Mello
12e6d6c189SCody Peter Mello#
13e6d6c189SCody Peter Mello# Copyright 2018 Joyent, Inc.
14e6d6c189SCody Peter Mello#
15e6d6c189SCody Peter Mello
16e6d6c189SCody Peter Melloinclude $(SRC)/cmd/Makefile.cmd
17e6d6c189SCody Peter Melloinclude $(SRC)/test/Makefile.com
18e6d6c189SCody Peter Mello
19e6d6c189SCody Peter MelloDATA_FILES =		\
20e6d6c189SCody Peter Mello	test.countries	\
21e6d6c189SCody Peter Mello	test.data
22e6d6c189SCody Peter Mello
23*3ee4fc2aSCody Peter MelloBUGS_AWK :sh= (cd bugs-fixed; print *.awk)
24*3ee4fc2aSCody Peter MelloBUGS_FILES = $(BUGS_AWK) $(BUGS_AWK:%.awk=%.ok)
25*3ee4fc2aSCody Peter Mello
26e6d6c189SCody Peter MelloEXAMPLES_FILES :sh= (cd examples/awk; print p.* t.*)
27e6d6c189SCody Peter Mello
28*3ee4fc2aSCody Peter MelloTESTS_FILES :sh= (cd tests; print T.* *.p *.ok chem.awk latin1 lilly.progs)
29e6d6c189SCody Peter Mello
30e6d6c189SCody Peter MelloGNU_AWK :sh= (cd gnu; print *.awk)
31e6d6c189SCody Peter MelloGNU_KSH :sh= (cd gnu; print *.sh)
32e6d6c189SCody Peter MelloGNU_IN :sh= (cd gnu; print *.in)
33e6d6c189SCody Peter Mello
34e6d6c189SCody Peter Mello#
35e6d6c189SCody Peter Mello# For the imported gnu/ tests, we have three different styles:
36e6d6c189SCody Peter Mello#
37e6d6c189SCody Peter Mello#   - AWK scripts with input
38e6d6c189SCody Peter Mello#   - AWK scripts with no input
39e6d6c189SCody Peter Mello#   - Shell scripts that run AWK scripts themselves
40e6d6c189SCody Peter Mello#
41e6d6c189SCody Peter Mello# All of these have a corresponding *.ok file, and we generate a *.awk
42e6d6c189SCody Peter Mello# dependency from each *.in file to check for bad test setups.
43e6d6c189SCody Peter Mello#
44e6d6c189SCody Peter MelloGNU_FILES =	\
45e6d6c189SCody Peter Mello	$(GNU_AWK) $(GNU_AWK:%.awk=%.ok) \
46e6d6c189SCody Peter Mello	$(GNU_KSH) $(GNU_KSH:%.sh=%.ok) \
47e6d6c189SCody Peter Mello	$(GNU_IN) $(GNU_KSH:%.in=%.awk) \
48*3ee4fc2aSCody Peter Mello	arynocls.data out1.ok out2.ok out3.ok # arynocls.awk & messages.sh data
49e6d6c189SCody Peter Mello
50e6d6c189SCody Peter MelloSYN_FILES :sh= (cd syn; print *.awk)
51e6d6c189SCody Peter Mello
52e6d6c189SCody Peter MelloROOTFILES =					\
53*3ee4fc2aSCody Peter Mello	$(BUGS_FILES:%=$(TESTDIR)/bugs-fixed/%)	\
54e6d6c189SCody Peter Mello	$(DATA_FILES:%=$(TESTDIR)/data/%)	\
55e6d6c189SCody Peter Mello	$(EXAMPLES_FILES:%=$(TESTDIR)/examples/awk/%) \
56e6d6c189SCody Peter Mello	$(EXAMPLES_FILES:%=$(TESTDIR)/examples/out/%) \
57e6d6c189SCody Peter Mello	$(TESTS_FILES:%=$(TESTDIR)/tests/%)	\
58e6d6c189SCody Peter Mello	$(GNU_FILES:%=$(TESTDIR)/gnu/%)	\
59e6d6c189SCody Peter Mello	$(SYN_FILES:%=$(TESTDIR)/syn/%) \
60e6d6c189SCody Peter Mello	$(SYN_FILES:%.awk=$(TESTDIR)/syn/%.ok) \
61e6d6c189SCody Peter Mello	$(TESTDIR)/runtests.sh
62e6d6c189SCody Peter Mello
63*3ee4fc2aSCody Peter MelloSUBDIRS = bugs-fixed data examples/awk examples/out gnu syn tests
64e6d6c189SCody Peter Mello
65e6d6c189SCody Peter MelloROOTOPTPKG = $(ROOT)/opt/util-tests
66e6d6c189SCody Peter MelloTESTDIR = $(ROOTOPTPKG)/tests/awk
67e6d6c189SCody Peter MelloTESTSUBDIRS = $(SUBDIRS:%=$(TESTDIR)/%)
68e6d6c189SCody Peter Mello
69e6d6c189SCody Peter Melloall lint clean clobber:
70e6d6c189SCody Peter Mello
71e6d6c189SCody Peter Melloinstall: all $(ROOTFILES)
72e6d6c189SCody Peter Mello
73e6d6c189SCody Peter Mello$(TESTDIR)/examples/% := FILEMODE=0444
74e6d6c189SCody Peter Mello$(TESTDIR)/data/% := FILEMODE=0444
75e6d6c189SCody Peter Mello$(TESTDIR)/%.data := FILEMODE=0444
76e6d6c189SCody Peter Mello$(TESTDIR)/%.awk := FILEMODE=0444
77e6d6c189SCody Peter Mello$(TESTDIR)/%.in := FILEMODE=0444
78e6d6c189SCody Peter Mello$(TESTDIR)/%.ok := FILEMODE=0444
79e6d6c189SCody Peter Mello$(TESTDIR)/%.sh := FILEMODE=0555
80e6d6c189SCody Peter Mello
81*3ee4fc2aSCody Peter Mello$(TESTDIR)/tests/lilly.progs := FILEMODE=0444
82e6d6c189SCody Peter Mello$(TESTDIR)/tests/latin1 := FILEMODE=0444
83e6d6c189SCody Peter Mello$(TESTDIR)/tests/T.% := FILEMODE=0555
84e6d6c189SCody Peter Mello$(TESTDIR)/tests/%.p := FILEMODE=0444
85e6d6c189SCody Peter Mello
86e6d6c189SCody Peter Mello$(TESTDIR):
87e6d6c189SCody Peter Mello	$(INS.dir)
88e6d6c189SCody Peter Mello
89e6d6c189SCody Peter Mello$(TESTSUBDIRS): $(TESTDIR)
90e6d6c189SCody Peter Mello	$(INS.dir)
91e6d6c189SCody Peter Mello
92e6d6c189SCody Peter Mello$(TESTDIR)/%: % $(TESTSUBDIRS)
93e6d6c189SCody Peter Mello	$(INS.file)
94