diff options
author | Tina Müller <cpan2@tinita.de> | 2017-12-02 01:06:12 +0100 |
---|---|---|
committer | Tina Müller <cpan2@tinita.de> | 2017-12-02 22:23:23 +0100 |
commit | e5aadc734909797f25057a795be0053669c80f1b (patch) | |
tree | c4fca561332035def35f834985dfd1887dd3d111 /tests | |
parent | fd5bf68a30725caa33a9166ea6dd4b49c18c2a93 (diff) | |
download | libyaml-git-e5aadc734909797f25057a795be0053669c80f1b.tar.gz |
Rewrite make test-suite
No recursive make anymore
Remove MY_LD_LIBRARY_PATH and friends
This is now done by the wrapper script
Remove LIBYAML_DIR variable
not needed anymore
Merge ReadMe.md files to one
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/run-emitter-test-suite.c (renamed from tests/run-test-suite/src/libyaml-emitter.c) | 0 | ||||
-rw-r--r-- | tests/run-parser-test-suite.c (renamed from tests/run-test-suite/src/libyaml-parser.c) | 0 | ||||
-rw-r--r-- | tests/run-test-suite/Makefile | 14 | ||||
-rw-r--r-- | tests/run-test-suite/ReadMe.md | 22 | ||||
-rw-r--r-- | tests/run-test-suite/src/Makefile | 54 | ||||
-rw-r--r-- | tests/run-test-suite/src/ReadMe.md | 34 | ||||
-rwxr-xr-x | tests/run-test-suite/test/libyaml-emitter.t | 7 | ||||
-rwxr-xr-x | tests/run-test-suite/test/libyaml-parser.t | 2 |
10 files changed, 28 insertions, 110 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d10b424..be2ce39 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,8 +11,10 @@ foreach(name IN ITEMS example-reformatter-alt run-dumper run-emitter + run-emitter-test-suite run-loader run-parser + run-parser-test-suite run-scanner test-reader test-version diff --git a/tests/Makefile.am b/tests/Makefile.am index 81decb4..9597b7f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,4 +5,5 @@ TESTS = test-version test-reader check_PROGRAMS = test-version test-reader noinst_PROGRAMS = run-scanner run-parser run-loader run-emitter run-dumper \ example-reformatter example-reformatter-alt \ - example-deconstructor example-deconstructor-alt + example-deconstructor example-deconstructor-alt \ + run-parser-test-suite run-emitter-test-suite diff --git a/tests/run-test-suite/src/libyaml-emitter.c b/tests/run-emitter-test-suite.c index 6c599e8..6c599e8 100644 --- a/tests/run-test-suite/src/libyaml-emitter.c +++ b/tests/run-emitter-test-suite.c diff --git a/tests/run-test-suite/src/libyaml-parser.c b/tests/run-parser-test-suite.c index b2c7f84..b2c7f84 100644 --- a/tests/run-test-suite/src/libyaml-parser.c +++ b/tests/run-parser-test-suite.c diff --git a/tests/run-test-suite/Makefile b/tests/run-test-suite/Makefile index 3d39edc..4b9570e 100644 --- a/tests/run-test-suite/Makefile +++ b/tests/run-test-suite/Makefile @@ -1,7 +1,6 @@ .PHONY: test GITHUB_ORG_URI := https://github.com/yaml TEST_SUITE_URL := $(GITHUB_ORG_URI)/yaml-test-suite -LIBYAML_DIR ?= $(PWD)/libyaml-parser-emitter/libyaml default: help @@ -10,11 +9,8 @@ help: @echo 'clean - Remove generated files' @echo 'help - Show help' -# Depends on parser and emitter but, building parser will also build emitter. -# Building twice makes things fail. Note: Some environments like on OS X, the -# shell resets the {DY,}LD_LIBRARY_PATH vars, so we work around it like so: -test: data src/libyaml-parser - (export MY_LD_LIBRARY_PATH=$(LIBYAML_DIR)/src/.libs; prove -lv test) +test: data + prove -lv test clean: rm -fr data @@ -22,9 +18,3 @@ clean: data: git clone $(TEST_SUITE_URL) $@ --branch=$@ -%/libyaml-parser %/libyaml-emitter: % - (cd $<; make clean build) - (cd $<; make clean build) - -libyaml-parser-emitter: - git clone $(GITHUB_ORG_URI)/$@ $@ diff --git a/tests/run-test-suite/ReadMe.md b/tests/run-test-suite/ReadMe.md index c1ef208..f991b37 100644 --- a/tests/run-test-suite/ReadMe.md +++ b/tests/run-test-suite/ReadMe.md @@ -1,17 +1,35 @@ LibYAML Test Runner =================== -Run libyaml-parser and libyaml-emitter against yaml-test-suite +Run run-parser-test-suite and run-emitter-test-suite against yaml-test-suite # Synopsis ``` make test +# Run tests from yaml-test-suite +make test-suite ``` # Overview See: -* https://github.com/yaml/libyaml * https://github.com/yaml/yaml-test-suite + +# Usage + +Print parse events for a YAML file (or stdin): +``` +../run-parser-test-suite file.yaml +../run-parser-test-suite < file.yaml +cat file.yaml | ../run-parser-test-suite +``` + +Print the YAML for a libyaml-parser events file (or stdin): +``` +../run-emitter-test-suite file.events +../run-emitter-test-suite < file.events +cat file.events | ../libyaml-run-test-suite +``` + diff --git a/tests/run-test-suite/src/Makefile b/tests/run-test-suite/src/Makefile deleted file mode 100644 index de0d49a..0000000 --- a/tests/run-test-suite/src/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -LIBYAML_DIR ?= libyaml -LIBYAML_REPO ?= https://github.com/yaml/libyaml -LIBYAML_BRANCH ?= master -define HELP -This Makefile supports the following targets: - - build - Build ./libyaml-parser and ./libyaml-emitter - test - Run tests - -endef -export HELP - -help: - @echo "$$HELP" - -build: touch libyaml-parser libyaml-emitter - -touch: -ifneq ($(LIBYAML_DIR),libyaml) - touch *.c -endif - -libyaml-%: $(LIBYAML_DIR)/tests/.libs/run-% - cp $< $@ - -$(LIBYAML_DIR)/tests/.libs/%: $(LIBYAML_DIR)/tests/%.c $(LIBYAML_DIR)/Makefile - make -C $(LIBYAML_DIR) -ifneq ($(LIBYAML_DIR),libyaml) - (cd $(LIBYAML_DIR) && git checkout tests/run-parser.c tests/run-emitter.c) -endif - -$(LIBYAML_DIR)/tests/run-%: libyaml-% $(LIBYAML_DIR) - cp $< $@ -.SECONDARY: \ - $(LIBYAML_DIR)/tests/run-parser.c \ - $(LIBYAML_DIR)/tests/run-emitter.c \ - $(LIBYAML_DIR)/tests/.libs/run-parser \ - $(LIBYAML_DIR)/tests/.libs/run-emitter - -$(LIBYAML_DIR)/Makefile: $(LIBYAML_DIR) - ( cd $< && ./bootstrap && ./configure ) - touch $@ - -$(LIBYAML_DIR): - git clone $(LIBYAML_REPO) $@ - sleep 1 - touch *.c - -.PHONY: test -test: build - prove -lv test/ - -clean: - rm -fr libyaml libyaml-parser libyaml-emitter diff --git a/tests/run-test-suite/src/ReadMe.md b/tests/run-test-suite/src/ReadMe.md deleted file mode 100644 index ced29cb..0000000 --- a/tests/run-test-suite/src/ReadMe.md +++ /dev/null @@ -1,34 +0,0 @@ -libyaml-parser-emitter -====================== - -Parser and Emitter CLI tools for libyaml - -# Synopsis - -``` -make build -make test -``` - -# Usage - -Print parse events for a YAML file (or stdin): -``` -./libyaml-parser file.yaml -./libyaml-parser < file.yaml -cat file.yaml | ./libyaml-parser -``` - -Print the YAML for a libyaml-parser events file (or stdin): -``` -./libyaml-emitter file.events -./libyaml-emitter < file.events -cat file.events | ./libyaml-emitter -``` - -# Build - -``` -export LIBYAML_DIR=/path/to/libyaml # Optional -make build -``` diff --git a/tests/run-test-suite/test/libyaml-emitter.t b/tests/run-test-suite/test/libyaml-emitter.t index 2b12b3a..b092c6f 100755 --- a/tests/run-test-suite/test/libyaml-emitter.t +++ b/tests/run-test-suite/test/libyaml-emitter.t @@ -8,11 +8,6 @@ else ids=($(cut -d: -f1 < test/libyaml-emitter.list)) fi -# Some environments like on OS X, the shell resets the following vars, so we -# work around it like so: -export LD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH:?}" -export DYLD_LIBRARY_PATH="${MY_LD_LIBRARY_PATH:?}" - count=0 for id in "${ids[@]}"; do dir="data/$id" @@ -20,7 +15,7 @@ for id in "${ids[@]}"; do [[ -e "$dir/in.yaml" ]] || continue want="$dir/out.yaml" [[ -e $want ]] || want="$dir/in.yaml" - ./src/libyaml-emitter "$dir/test.event" > /tmp/test.out || { + ../../tests/run-emitter-test-suite "$dir/test.event" > /tmp/test.out || { ( cat "$dir/test.event" cat "$want" diff --git a/tests/run-test-suite/test/libyaml-parser.t b/tests/run-test-suite/test/libyaml-parser.t index 1c3d0c4..6be2395 100755 --- a/tests/run-test-suite/test/libyaml-parser.t +++ b/tests/run-test-suite/test/libyaml-parser.t @@ -13,7 +13,7 @@ for id in "${ids[@]}"; do dir="data/$id" label="$id: $(< $dir/===)" [[ -e "$dir/in.yaml" ]] || continue - ./src/libyaml-parser "$dir/in.yaml" > /tmp/test.out || { + ../../tests/run-parser-test-suite "$dir/in.yaml" > /tmp/test.out || { ( cat "$dir/in.yaml" cat "$dir/test.event" |