Skip to content

Commit

Permalink
Merge pull request svaarala#2493 from svaarala/switch-to-js-test-tooling
Browse files Browse the repository at this point in the history
Switch to rewritten JS-based test tooling
  • Loading branch information
svaarala authored Jul 9, 2022
2 parents 5fc50c9 + d0bcd6a commit d3c3264
Show file tree
Hide file tree
Showing 194 changed files with 2,393 additions and 1,272 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/build-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ name: Build
on: [push, pull_request]
jobs:
build_duk_ubuntu:
name: Duk Ubuntu 18.04
runs-on: ubuntu-18.04
name: Duk Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git
sudo apt -qqy install build-essential make python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build
run: |
make build/duk build/dukd build/duk-g++ build/duk-clang build/duk-fuzzilli
Expand All @@ -20,14 +24,18 @@ jobs:
build/duk dist-files/mandel.js
build/duk-g++ dist-files/mandel.js
build_duk_macos:
name: Duk macOS 10.15
runs-on: macos-10.15
name: Duk macOS 12
runs-on: macos-12
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
python2 -m pip install PyYAML
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build
run: |
make build/duk
Expand All @@ -36,8 +44,8 @@ jobs:
build/duk -e "print(Duktape.env); print('Hello world!');"
build/duk dist-files/mandel.js
build_duk_windows:
name: Duk VS2019
runs-on: windows-2019
name: Duk VS2022
runs-on: windows-2022
strategy:
matrix:
architecture: [ 'x86', 'amd64' ]
Expand All @@ -47,8 +55,8 @@ jobs:
- name: Build
shell: cmd
run: |
REM call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.architecture}}
REM call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.architecture}}
REM cl /?
REM python2 -m pip install PyYAML
REM python2 tools\configure.py --line-directives --output-directory prep-nondll --source-directory src-input --config-metadata config
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/dist-tag-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ on:
jobs:
dist_source:
name: Source
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git
sudo apt -qqy install build-essential make python2 python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Dist source
run: |
make dist-source
Expand All @@ -23,14 +27,18 @@ jobs:
path: dist/*.tar.xz
dist_site:
name: Site
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git
sudo apt -qqy install build-essential make python2 python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Docker images
run: |
make docker-images
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/dist-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ on: [push, pull_request]
jobs:
dist_source:
name: Source
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git
sudo apt -qqy install build-essential make python2 python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Dist source
run: |
make dist-source
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ on:
jobs:
dist_source_and_site:
name: Dist source and site
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git
sudo apt -qqy install build-essential make python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Docker images
run: |
make docker-images
Expand Down
44 changes: 32 additions & 12 deletions .github/workflows/test-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,58 @@ on: [push, pull_request]
jobs:
ecmatest:
name: Ecmatest
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git nodejs
sudo apt -qqy install build-essential make python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build
run: |
make build/duk
- name: Ecmatest
run: |
make ecmatest
TZ=Europe/Helsinki make ecmatest
apitest:
name: Apitest
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git nodejs
sudo apt -qqy install build-essential make python3 python3-yaml bc git
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build
run: |
make build/duk
- name: Apitest
run: |
make apitest
TZ=Europe/Helsinki make apitest
misctests:
name: Misc tests
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git nodejs valgrind
sudo apt -qqy install build-essential make python2 python3 python3-yaml bc git valgrind
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Configure test
run: |
make configuretest
Expand All @@ -51,14 +63,18 @@ jobs:
make errorinjecttest
lint:
name: Lint
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install build-essential make python python-yaml bc git tidy
sudo apt -qqy install build-essential make python2 python3 python3-yaml bc git tidy
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Codepolicycheck
run: |
CI=1 make codepolicycheck
Expand All @@ -67,14 +83,18 @@ jobs:
make tidy-site
sourceformat:
name: Source format
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages
run: |
sudo apt -qqy update
sudo apt -qqy install make python zip unzip
sudo apt -qqy install make python3 python3-yaml zip unzip
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build clang-format docker image
run: |
make docker-image-clang-format
Expand Down
57 changes: 37 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -654,28 +654,46 @@ releasetest: configuretest xmldoctest closuretest bluebirdtest luajstest jsinter
@echo ""
@echo "### Release tests successful!" # These tests now have output checks.

# Runtests-based ECMAScript and API tests.
.PHONY: runtestsdeps
runtestsdeps: | runtests/node_modules deps/UglifyJS
runtests/node_modules:
@echo "Installing required NodeJS modules for runtests"
@cd runtests; npm install
# ECMAScript, API, and perf tests.
.PHONY: ecmatest
ecmatest: runtestsdeps build/duk | tmp
ecmatest: prep-duktool | tmp deps/UglifyJS
@echo "### ecmatest"
"$(NODEJS)" runtests/runtests.js $(RUNTESTSOPTS) --run-duk --cmd-duk=$(shell pwd)/build/duk --num-threads 16 --log-file=tmp/duk-test.log tests/ecmascript/
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/duk-test.log tests/ecmascript/
.PHONY: ecmatest-comparison
ecmatest-comparison: runtestsdeps build/duk | tmp
@echo "### ecmatest"
"$(NODEJS)" runtests/runtests.js $(RUNTESTSOPTS) --run-duk --cmd-duk=$(shell pwd)/build/duk --report-diff-to-other --run-nodejs --run-rhino --num-threads 16 --log-file=tmp/duk-test.log tests/ecmascript/

.PHONY: apitest
ifeq ($(DETECTED_OS),Darwin)
apitest: runtestsdeps build/libduktape.1.0.0.so | tmp
apitest: prep-duktool | tmp deps/UglifyJS
else
apitest: runtestsdeps build/libduktape.so.1.0.0 | tmp
apitest: prep-duktool | tmp deps/UglifyJS
endif
@echo "### apitest"
"$(NODEJS)" runtests/runtests.js $(RUNTESTSOPTS) --num-threads 1 --log-file=tmp/duk-api-test.log tests/api/
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/duk-api-test.log tests/api/

TEST_ALL_DIRS=tests/api/ tests/ecmascript/ tests/configure/ tests/perf/
.PHONY: test-all
test-all: prep-duktool | tmp deps/UglifyJS
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/test-all.log $(TEST_ALL_DIRS)
.PHONY: test-all-1
test-all-1: prep-duktool | tmp deps/UglifyJS
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/test-all-1.log --test-hash-min 0 --test-hash-max 63 $(TEST_ALL_DIRS)
.PHONY: test-all-2
test-all-2: prep-duktool | tmp deps/UglifyJS
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/test-all-2.log --test-hash-min 64 --test-hash-max 127 $(TEST_ALL_DIRS)
.PHONY: test-all-3
test-all-3: prep-duktool | tmp deps/UglifyJS
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/test-all-3.log --test-hash-min 128 --test-hash-max 191 $(TEST_ALL_DIRS)
.PHONY: test-all-4
test-all-4: prep-duktool | tmp deps/UglifyJS
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --test-log-file tmp/test-all-4.log --test-hash-min 192 --test-hash-max 255 $(TEST_ALL_DIRS)

.PHONY: perftest
perftest: prep-duktool | tmp deps/UglifyJS
@echo "### perftest"
"$(NODEJS)" src-tools/index.js run-tests --uglifyjs-bin deps/UglifyJS/bin/uglifyjs --num-threads 1 --test-log-file tmp/duk-perf-test.log tests/perf/

# Configure tests.
.PHONY: configuretest
Expand Down Expand Up @@ -949,14 +967,13 @@ deps/closure-compiler/build/compiler.jar: | deps/closure-compiler
deps/closure-compiler.jar: deps/closure-compiler/build/compiler.jar
cp $< $@
touch $@
deps/uglifyjs-v3.9.2.tar.gz: | deps
@# https://github.com/mishoo/UglifyJS
@# Don't use this because it's a moving dependency
@#$(GIT) clone -q --depth 1 https://github.com/mishoo/UglifyJS2.git
$(WGET) -q https://github.com/svaarala/UglifyJS/archive/v3.9.2.tar.gz -O $@
deps/UglifyJS: deps/uglifyjs-v3.9.2.tar.gz | deps tmp
deps/uglifyjs-v3.15.0.tar.gz: | deps
#$(WGET) -q https://github.com/mishoo/UglifyJS/archive/refs/tags/v3.15.0.tar.gz -O $@
$(WGET) -q https://github.com/svaarala/UglifyJS/archive/refs/tags/v3.15.0.tar.gz -O $@
touch $@
deps/UglifyJS: deps/uglifyjs-v3.15.0.tar.gz | deps tmp
tar -C tmp -x -z -f $<
mv tmp/UglifyJS-3.9.2 $@
mv tmp/UglifyJS-3.15.0 $@
cd $@ && npm install
touch $@
deps/coffee-script: | deps
Expand Down Expand Up @@ -1031,8 +1048,8 @@ doc/%.html: doc/%.txt
rst2html $< $@

# Source distributable for end users.
dist/source: prep-duktool | codepolicycheck dist
$(PYTHON) util/dist.py --output-directory $@
dist/source: build/duktool.js prep-duktool | codepolicycheck dist
$(NODEJS) $< dist --validate-git --repo-directory . --output-directory $@
cp src-tools/duktool.js $@/tools/
dist/duktape-$(DUK_VERSION_FORMATTED).tar: dist/source | dist
rm -rf dist/duktape-$(DUK_VERSION_FORMATTED) dist/duktape-$(DUK_VERSION_FORMATTED).*
Expand Down
4 changes: 2 additions & 2 deletions doc/code-issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ The ``DUK_INTERNAL_DECL`` idiom is::
DUK_INTERNAL_DECL const char *duk_str_not_object;
#endif /* !DUK_SINGLE_FILE */

For this to work in the single file case, ``tools/combine_src.py`` must
ensure that the symbol definition appears before its use. This is currently
For this to work in the single file case, configure tooling must ensure
that the symbol definition appears before its use. This is currently
handled via manual file reordering.

Concrete example
Expand Down
Loading

0 comments on commit d3c3264

Please sign in to comment.