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