Skip to content
Snippets Groups Projects
Makefile 2.60 KiB
LC0=../lus2lic
LC=../lus2lic -vl 2
LC2=../lus2lic

NL="----------------------------------------------------------------------\\n"
filter_line=grep -v Opening\ file

OK_LUS=$(shell find should_work -name "*.lus" -print | LC_ALL=C sort -n)

KO_LUS=$(shell find should_fail -name "*.lus" -print | LC_ALL=C sort -n)

ALL_LUS=$(OK_LUS) $(KO_LUS)

LIC=$(shell find should_work -name "*.lic" -print | LC_ALL=C sort -n)


when:
	for d in ${ALL_LUS}; do \
		ls $$d; \
		grep -n " when" $$d; \
	done
tgz:
	tar cvfz lustre_non_reg_files.tgz should_work should_fail


lic:
	echo "generate all possible lic files"
	for d in ${OK_LUS}; do \
		echo -e "\n$(NL)====> $(LC2) $$d -o $$d.lic " ;\
		$(LC2) $$d -o $$d.lic ;\
	done

xxx:
	echo "reentrant ?"
	for d in ${LIC}; do \
		echo -e "\n$(NL)====> $(LC2) $$d  " ;\
		$(LC2) $$d > /dev/null ;\
	done


begin:
	echo "Non-regression tests" > test_ok.res
	echo "Those tests are supposed to generate errors" > test_ko.res


unit:
	$(LC0) -unit >> test_ok.res 2>&1

help:
	$(LC0) -help >> test_ok.res 2>&1

version:
	$(LC0) --version 

FILTER= grep -v "file was generated by" | grep -v " on "

do_not_exist:
	$(LC) do_not_exist.lus | $(FILTER) >> test_ko.res 2>&1 || true

same_file:
	$(LC) should_work/NONREG/ex.lus should_work/NONREG/ex.lus >> test_ok.res 2>&1

test: begin unit help version do_not_exist same_file
	for d in ${OK_LUS}; do \
		echo -e "\n$(NL)====> $(LC) $$d" >> test_ok.res; \
		$(LC) $$d >> test_ok.res 2>&1 ;\
	done; \
	for d in ${KO_LUS}; do \
		echo -e  "\n$(NL)====> $(LC) $$d" >> test_ko.res; \
		$(LC) $$d >> test_ko.res 2>&1 ;\
	done; \
	rm -f test.res ; cat test_ok.res test_ko.res  | $(FILTER) > test.res ;\
	diff -u test.res.exp test.res > test.diff || \
		(cat test.diff ; echo "cf test.diff"; exit 1)
utest:
	cp test.res test.res.exp 


errors_nb:
	echo -e "There were $(shell grep Error test_ok.res | wc -l) errors."
	echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings."

errors:errors_nb
	echo -e "There were $(shell grep Warning test_ok.res | wc -l) Warnings."
	grep Warning test_ok.res || true
	echo -e "There were $(shell grep Error test_ok.res | wc -l) errors."
	grep "*** Error" test_ok.res





test_ec: 
	rm test_ec.res
	for d in ${OK_LUS}; do \
		echo -e "\n$(NL)====> $(LC) -ec $$d -o /tmp/xx.ec" >> test_ec.res; \
		$(LC0) -ec $$d -o /tmp/xx.ec >> test_ec.res 2>&1 ;\
		echo -e "ec2c /tmp/xx.ec" >> test_ec.res; \
		ec2c /tmp/xx.ec >> test_ec.res 2>&1 ;\
	done; \
	diff -u test_ec.res.exp test_ec.res > test_ec.diff || \
		(cat test.diff ; echo "cf test.diff"; exit 1)


utest_ec:
	cp test_ec.res test_ec.res.exp 



clean:
	for d in ${ALL_LUS}; do \
		rm $$d.lic; \
	done