summaryrefslogtreecommitdiff
path: root/Makefile
blob: d6b01a2edd0ae09a4550aee4cfc3f449226805f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
SHELL = bash

export ENV := $(shell pwd)/env

ifdef env
    export LIBYAML_TEST_SUITE_ENV := $(env)
endif

.ONESHELL:
.PHONY: test
test: data
	@set -ex
	[[ "$(debug)" ]] && export LIBYAML_TEST_SUITE_DEBUG=1
	export LIBYAML_TEST_SUITE_ENV=$$(./lookup env)
	[[ $$LIBYAML_TEST_SUITE_ENV ]] || exit 1
	set +ex
	(set -x; prove -v test/)
	if [[ $$LIBYAML_TEST_SUITE_ENV == env/default ]]; then
	  ./lookup default-warning
	fi

test-all:
	prove -v test/test-all.sh

data:
	@set -ex
	[[ "$(debug)" ]] && export LIBYAML_TEST_SUITE_DEBUG=1
	data=$$(./lookup data); repo=$${data%\ *}; commit=$${data#*\ }
	[[ $$data ]] || exit 1
	echo "repo=$$repo commit=$$commit"
	git clone $$repo $@
	(cd $@ && git reset --hard $$commit)

clean:
	rm -fr data
	rm -f env/tmp-*