Skip to content

Commit

Permalink
Rewrite make test-suite
Browse files Browse the repository at this point in the history
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
  • Loading branch information
perlpunk committed Dec 2, 2017
1 parent fd5bf68 commit e5aadc7
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 111 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ Makefile.in
/libyaml.a
/run-dumper
/run-emitter
/run-emitter-test-suite
/run-loader
/run-parser
/run-parser-test-suite
/run-scanner
/src/Makefile
/stamp-h1
Expand All @@ -46,8 +48,10 @@ Makefile.in
/tests/example-reformatter-alt
/tests/run-dumper
/tests/run-emitter
/tests/run-emitter-test-suite
/tests/run-loader
/tests/run-parser
/tests/run-parser-test-suite
/tests/run-scanner
/tests/run-test-suite/data
tests/run-test-suite/src/libyaml/
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ test: all
make -C tests check-TESTS

test-suite:
(export LIBYAML_DIR=$$PWD; make -C tests/run-test-suite test)
make -C tests/run-test-suite test

test-all: test test-suite
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
14 changes: 2 additions & 12 deletions tests/run-test-suite/Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -10,21 +9,12 @@ 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

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)/$@ $@
22 changes: 20 additions & 2 deletions tests/run-test-suite/ReadMe.md
Original file line number Diff line number Diff line change
@@ -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
```

54 changes: 0 additions & 54 deletions tests/run-test-suite/src/Makefile

This file was deleted.

34 changes: 0 additions & 34 deletions tests/run-test-suite/src/ReadMe.md

This file was deleted.

7 changes: 1 addition & 6 deletions tests/run-test-suite/test/libyaml-emitter.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ 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"
label="$id: $(< $dir/===)"
[[ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/run-test-suite/test/libyaml-parser.t
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e5aadc7

Please sign in to comment.