<commit_before>#
# credits: 01..13.c from the pcc cpp-tests suite
#

TOP = ../..
include $(TOP)/config.mak
SRC = $(TOPSRC)/tests/pp
VPATH = $(SRC)

TCC = ../../tcc
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
TESTS = $(call files,c) $(call files,S)

all test : $(sort $(TESTS))

DIFF_OPTS = -Nu -b -B -I "^\#"

# Filter source directory in warnings/errors (out-of-tree builds)
FILTER = 2>&1 | sed 's,$(SRC)/,,g'

%.test: %.c %.expect
	@echo PPTest $* ...
	-@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
	    diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
	    && rm -f $*.output

%.test: %.S %.expect
	@echo PPTest $* ...
	-@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
	    diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
	    && rm -f $*.output

# automatically generate .expect files with gcc:
%.expect: %.c
	gcc -E -P $< >$*.expect 2>&1

%.expect: %.S
	gcc -E -P $< >$*.expect 2>&1

# tell make not to delete
.PRECIOUS: %.expect

clean:
	rm -f *.output

02.test : DIFF_OPTS += -w
15.test : DIFF_OPTS += -I"^XXX:"<commit_msg>tests: don't assume $(CC) is gcc<commit_after>#
# credits: 01..13.c from the pcc cpp-tests suite
#

TOP = ../..
include $(TOP)/config.mak
SRC = $(TOPSRC)/tests/pp
VPATH = $(SRC)

TCC = ../../tcc
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
TESTS = $(call files,c) $(call files,S)

all test : $(sort $(TESTS))

DIFF_OPTS = -Nu -b -B -I "^\#"

# Filter source directory in warnings/errors (out-of-tree builds)
FILTER = 2>&1 | sed 's,$(SRC)/,,g'

%.test: %.c %.expect
	@echo PPTest $* ...
	-@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
	    diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
	    && rm -f $*.output

%.test: %.S %.expect
	@echo PPTest $* ...
	-@$(TCC) -E -P $< $(FILTER) >$*.output 2>&1 ; \
	    diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
	    && rm -f $*.output

# automatically generate .expect files with gcc:
%.expect: %.c
	$(CC) -E -P $< >$*.expect 2>&1

%.expect: %.S
	$(CC) -E -P $< >$*.expect 2>&1

# tell make not to delete
.PRECIOUS: %.expect

clean:
	rm -f *.output

02.test : DIFF_OPTS += -w
15.test : DIFF_OPTS += -I"^XXX:"
{'fraction_non_alphanumeric': 0.25953838907206783, 'fraction_numerical': 0.018841262364578427, 'mean_word_length': 2.7526501766784452, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6465834', 'n_tokens_mistral': 940, 'n_tokens_neox': 881, 'n_words': 244}