Skip to content

Commit

Permalink
Run external test suites from the yaml/libyaml-test repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jun 16, 2020
1 parent 2c891fc commit 4c35159
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- run: |
git clean -d -x -f
rm -fr tests/run-test-suite
rm -fr libyaml-test
git worktree prune
- name: Compiler version
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ config.h*
stamp-h1
!config/config.h.in
/packaging/
/libyaml-test/
/tests/run-dumper
/tests/run-emitter
/tests/run-emitter-test-suite
Expand All @@ -40,7 +41,6 @@ stamp-h1
/tests/example-deconstructor-alt
/tests/example-reformatter
/tests/example-reformatter-alt
/tests/run-test-suite
/tests/test-reader
/tests/test-version
/dist/
6 changes: 2 additions & 4 deletions .makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ MAKE_TARGETS := \
test-all \
test-suite \

# SOURCE_FILES := $(shell find . | grep '\.c$$')
SOURCE_FILES := $(shell find tests/run-test-suite | grep '\.c$$')
SOURCE_FILES := $(shell find . | grep '\.c$$')
ifneq ($(shell which gindent),)
INDENT := gindent
else
Expand Down Expand Up @@ -59,5 +58,4 @@ indent:

distclean purge:
git clean -dxf -e GNUmakefile
rm -fr tests/run-test-suite
git worktree prune
rm -fr libyaml-test
46 changes: 25 additions & 21 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ SUBDIRS = include src . tests

EXTRA_DIST = Changes ReadMe.md License CMakeLists.txt doc/doxygen.cfg

LIBYAML_TEST_SUITE_RUN_REPO_DEFAULT := https://github.com/yaml/libyaml
LIBYAML_TEST_SUITE_RUN_REPO ?= $(LIBYAML_TEST_SUITE_RUN_REPO_DEFAULT)
LIBYAML_TEST_SUITE_RUN_BRANCH ?= run-test-suite
export LIBYAML_ROOT := $(PWD)

LIBYAML_TEST_REPO ?= https://github.com/yaml/libyaml-test
LIBYAML_TEST_COMMIT ?= 1f1b00ab6763647d05e44200b63fa62f1d2269a3

# XXX
LIBYAML_TEST_REPO := https://github.com/yaml/libyaml-test
LIBYAML_TEST_COMMIT := origin/master

# NOTE: Uncomment to use a local copy of libyaml-test
# LIBYAML_TEST_REPO := ../libyaml-test/.git
# LIBYAML_TEST_COMMIT := master

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = yaml-0.1.pc
Expand All @@ -17,38 +26,33 @@ maintainer-clean-local:
-find ${builddir} -name Makefile.in -exec rm -f '{}' ';'

distclean-local:
rm -fr tests/run-test-suite packaging
rm -fr libyaml-test packaging
-git worktree prune

.PHONY: bootstrap
.PHONY: bootstrap libyaml-test
bootstrap: maintainer-clean
./bootstrap
./configure
make

test-all: test test-suite

test: all
make -C tests check-TESTS

test-suite: tests/run-test-suite all
make -C $< test

test-all: test test-suite
test-suite: libyaml-test all
make -C $< $@

tests/run-test-suite:
ifeq ($(LIBYAML_TEST_SUITE_RUN_REPO),$(LIBYAML_TEST_SUITE_RUN_REPO_DEFAULT))
-git branch --track $(LIBYAML_TEST_SUITE_RUN_BRANCH) origin/$(LIBYAML_TEST_SUITE_RUN_BRANCH)
-git worktree prune
git worktree add $@ $(LIBYAML_TEST_SUITE_RUN_BRANCH)
else
git clone --branch $(LIBYAML_TEST_SUITE_RUN_BRANCH) $(LIBYAML_TEST_SUITE_RUN_REPO) $@
endif

packaging:
-git branch --track $@ origin/$@
git worktree add --force $@ $@
libyaml-test:
-git clone $(LIBYAML_TEST_REPO) $@
( cd $@ && git reset --hard $(LIBYAML_TEST_COMMIT) )

docker-dist: packaging
make -C $</docker libyaml-dist

docker-test-pyyaml: packaging
make -C $</docker test-pyyaml

packaging:
-git branch --track $@ origin/$@
git worktree add --force $@ $@
3 changes: 1 addition & 2 deletions tests/run-all-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ main() {

clean() {
git clean -d -x -f
rm -fr tests/run-test-suite
git worktree prune
rm -fr libyaml-test
}

main "$@"

0 comments on commit 4c35159

Please sign in to comment.