Skip to content

Commit fab5050

Browse files
committed
Separate debug tests into own testsuite tests-debug
1 parent e7cc2d1 commit fab5050

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

alex.cabal

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,15 @@ test-suite tests
154154
build-depends:
155155
base < 5
156156
, process
157+
158+
test-suite tests-debug
159+
type: exitcode-stdio-1.0
160+
main-is: test-debug.hs
161+
-- This line is important as it ensures that the local `exe:alex` component declared above is built before the test-suite component is invoked, as well as making sure that `alex` is made available on $PATH and `$alex_datadir` is set accordingly before invoking `test.hs`
162+
build-tools: alex
163+
164+
default-language: Haskell2010
165+
166+
build-depends:
167+
base < 5
168+
, process

test-debug.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import System.Process (system)
2+
import System.Exit (exitWith)
3+
4+
main = system "make -k -C tests clean tests-debug" >>= exitWith

test.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import System.Process (system)
22
import System.Exit (exitWith)
33

4-
main = system "make -k -C tests clean all" >>= exitWith
4+
main = system "make -k -C tests clean tests" >>= exitWith

tests/Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ TEST_ALEX_OPTS=
107107

108108
CLEAN_FILES += *.n.hs *.g.hs *.d.hs *.info *.hi *.o *.bin *.exe
109109

110-
ALL_TEST_HS = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.n.hs \1.g.hs \1.d.hs/g')
110+
TESTS_HS = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.n.hs \1.g.hs/g')
111+
TESTS_HS_DEBUG = $(shell echo $(TESTS) $(TEXT_TESTS) | sed -e 's/\([^\. ]*\)\.\(l\)\{0,1\}x/\1.d.hs/g')
112+
TESTS_HS_ALL = $(TESTS_HS) $(TESTS_HS_DEBUG)
111113

112-
ALL_TESTS = $(patsubst %.hs, %.run, $(ALL_TEST_HS))
114+
BASIC_TESTS = $(patsubst %.hs, %.run, $(TESTS_HS))
115+
DEBUG_TESTS = $(patsubst %.hs, %.run, $(TESTS_HS_DEBUG))
116+
ALL_TESTS = $(BASIC_TESTS) $(DEBUG_TESTS)
113117

114118
%.run : %$(HS_PROG_EXT)
115119
./$<
@@ -119,17 +123,15 @@ ALL_TESTS = $(patsubst %.hs, %.run, $(ALL_TEST_HS))
119123

120124
all :: $(ALL_TESTS)
121125

126+
tests :: $(BASIC_TESTS)
127+
128+
tests-debug :: $(DEBUG_TESTS)
129+
122130
.PHONY: clean debug
123131

124132
clean:
125133
rm -f $(CLEAN_FILES)
126134

127-
# NOTE: The `../dist` path belows don't aren't accurate anymore for recent cabals
128-
interact:
129-
ghci -cpp -i../src -i../dist/build/autogen -i../dist/build/alex/alex-tmp Main -fbreak-on-exception
130-
# -args='--template=.. simple.x -o simple.n.hs'
131-
# :set args --template=.. simple.x -o simple.n.hs
132-
133135
debug :
134136
@echo ALEX = $(ALEX)
135137
@echo HC_OPTS = $(HC_OPTS)

0 commit comments

Comments
 (0)