From 8ad919ed007436a0358b9fc81e487e74e580df39 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 31 Aug 2020 11:51:40 -0700 Subject: [PATCH] test: new CI job to test the XS vat worker This changes the "test swingset" CI job to additionally build the XS toolkit (written in C), and then use that toolkit to compile the `xs-vat-worker` program. The SwingSet unit tests will then exercise this program (they skip the test unless the program is available). To make the results more visible, another small step was added to run just the one unit test that exercises `xs-vat-worker`. The `git clone` steps were changed to include submodules, since the xs-vat-worker package uses a git submodule to fetch our modified version of the XS source tree. refs #1299 --- .github/workflows/test-all-packages.yml | 24 +++++ package.json | 3 +- packages/SwingSet/package.json | 1 + packages/xs-vat-worker/.gitignore | 1 + packages/xs-vat-worker/compartmap.json | 127 ------------------------ packages/xs-vat-worker/package.json | 1 + packages/xs-vat-worker/xs-lin.mk | 24 ++++- 7 files changed, 50 insertions(+), 131 deletions(-) delete mode 100644 packages/xs-vat-worker/compartmap.json diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 7c99c6973d7..2a02224d459 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -17,6 +17,8 @@ jobs: node-version: ['12.14.1', '12.x', '14.x'] steps: - uses: actions/checkout@v1 + with: + submodules: 'true' - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} @@ -62,6 +64,8 @@ jobs: path: . key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} - uses: actions/checkout@v1 + with: + submodules: 'true' if: steps.built.outputs.cache-hit != 'true' - name: yarn install run: yarn install @@ -95,6 +99,8 @@ jobs: path: . key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} - uses: actions/checkout@v1 + with: + submodules: 'true' if: steps.built.outputs.cache-hit != 'true' - name: yarn install run: yarn install @@ -252,6 +258,8 @@ jobs: path: . key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} - uses: actions/checkout@v1 + with: + submodules: 'true' if: steps.built.outputs.cache-hit != 'true' - name: yarn install run: yarn install @@ -296,18 +304,32 @@ jobs: path: . key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} - uses: actions/checkout@v1 + with: + submodules: 'true' if: steps.built.outputs.cache-hit != 'true' - name: yarn install run: yarn install if: steps.built.outputs.cache-hit != 'true' + - name: install XS dependencies + working-directory: ./packages/xs-vat-worker + run: yarn install:xs-lin - name: yarn build run: yarn build if: steps.built.outputs.cache-hit != 'true' + - name: yarn build-xs-worker + working-directory: ./packages/xs-vat-worker + run: yarn build:xs-lin # END-RESTORE-BOILERPLATE - name: yarn test (SwingSet) run: cd packages/SwingSet && yarn test env: ESM_DISABLE_CACHE: true + # explicitly test the XS worker, for visibility + - name: yarn test (SwingSet XS Worker) + working-directory: ./packages/SwingSet + run: yarn test-xs-worker + env: + ESM_DISABLE_CACHE: true test-zoe: # BEGIN-TEST-BOILERPLATE @@ -329,6 +351,8 @@ jobs: path: . key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} - uses: actions/checkout@v1 + with: + submodules: 'true' if: steps.built.outputs.cache-hit != 'true' - name: yarn install run: yarn install diff --git a/package.json b/package.json index c49e4e56a46..46bbf81eeb8 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,8 @@ "test": "yarn workspaces run test", "build": "yarn workspaces run build", "postinstall": "patch-package", - "patch-package": "patch-package" + "patch-package": "patch-package", + "build-xs-worker": "cd packages/xs-vat-worker && yarn build:xs-lin" }, "dependencies": { "patch-package": "^6.2.2" diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index ee9460a04d5..02bc7f625dd 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -13,6 +13,7 @@ "scripts": { "build": "exit 0", "test": "ava", + "test:xs-worker": "ava test/workers/test-worker.js -m 'xs vat manager'", "pretty-fix": "prettier --write '**/*.js'", "pretty-check": "prettier --check '**/*.js'", "lint-fix": "yarn lint --fix", diff --git a/packages/xs-vat-worker/.gitignore b/packages/xs-vat-worker/.gitignore index 3fe6843e951..596053c3962 100644 --- a/packages/xs-vat-worker/.gitignore +++ b/packages/xs-vat-worker/.gitignore @@ -1,2 +1,3 @@ .envrc build/ +compartmap.json diff --git a/packages/xs-vat-worker/compartmap.json b/packages/xs-vat-worker/compartmap.json deleted file mode 100644 index cf92f156707..00000000000 --- a/packages/xs-vat-worker/compartmap.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "main": "packages/xs-vat-worker/", - "compartments": { - "packages/xs-vat-worker/": { - "label": "@agoric/xs-vat-worker@0.1.0", - "location": "packages/xs-vat-worker/", - "contents": [ - "./src/vatWorker.js" - ], - "modules": { - "@agoric/import-bundle": { - "compartment": "node_modules/@agoric/import-bundle/", - "module": "./src/index.js" - }, - "@agoric/marshal": { - "compartment": "node_modules/@agoric/marshal/", - "module": "./marshal.js" - }, - "@agoric/swingset-vat/src/kernel/liveSlots": { - "compartment": "node_modules/@agoric/swingset-vat/", - "module": "./src/kernel/liveSlots.js" - } - } - }, - "node_modules/@agoric/import-bundle/": { - "label": "@agoric/import-bundle@0.0.8", - "location": "node_modules/@agoric/import-bundle/", - "contents": [ - "./src/index.js", - "./src/compartment-wrapper.js" - ], - "modules": {} - }, - "node_modules/@agoric/marshal/": { - "label": "@agoric/marshal@0.2.3", - "location": "node_modules/@agoric/marshal/", - "contents": [ - "./marshal.js" - ], - "modules": { - "@agoric/nat": { - "compartment": "node_modules/@agoric/nat/", - "module": "./dist/nat.esm.js" - }, - "@agoric/promise-kit": { - "compartment": "node_modules/@agoric/promise-kit/", - "module": "./src/promiseKit.js" - } - } - }, - "node_modules/@agoric/swingset-vat/": { - "label": "@agoric/swingset-vat@0.6.0", - "location": "node_modules/@agoric/swingset-vat/", - "contents": [ - "./src/kernel/liveSlots.js", - "./src/parseVatSlots.js", - "./src/capdata.js" - ], - "modules": { - "@agoric/marshal": { - "compartment": "node_modules/@agoric/marshal/", - "module": "./marshal.js" - }, - "@agoric/assert": { - "compartment": "node_modules/@agoric/assert/", - "module": "./src/assert.js" - }, - "@agoric/promise-kit": { - "compartment": "node_modules/@agoric/promise-kit/", - "module": "./src/promiseKit.js" - }, - "@agoric/nat": { - "compartment": "node_modules/@agoric/nat/", - "module": "./dist/nat.esm.js" - } - } - }, - "node_modules/@agoric/nat/": { - "label": "@agoric/nat@2.0.1", - "location": "node_modules/@agoric/nat/", - "contents": [ - "./dist/nat.esm.js" - ], - "modules": {} - }, - "node_modules/@agoric/promise-kit/": { - "label": "@agoric/promise-kit@0.1.3", - "location": "node_modules/@agoric/promise-kit/", - "contents": [ - "./src/promiseKit.js" - ], - "modules": {} - }, - "node_modules/@agoric/assert/": { - "label": "@agoric/assert@0.0.8", - "location": "node_modules/@agoric/assert/", - "contents": [ - "./src/assert.js", - "./src/types.js" - ], - "modules": {} - } - }, - "modules": { - "node_modules/0_MKDIR": "$(ROOT)/node_modules/0_MKDIR", - "node_modules/@agoric/0_MKDIR": "$(ROOT)/node_modules/@agoric/0_MKDIR", - "node_modules/@agoric/assert/0_MKDIR": "$(ROOT)/node_modules/@agoric/assert/0_MKDIR", - "node_modules/@agoric/assert/src/assert": "$(ROOT)/node_modules/@agoric/assert/src/assert", - "node_modules/@agoric/assert/src/types": "$(ROOT)/node_modules/@agoric/assert/src/types", - "node_modules/@agoric/import-bundle/0_MKDIR": "$(ROOT)/node_modules/@agoric/import-bundle/0_MKDIR", - "node_modules/@agoric/import-bundle/src/compartment-wrapper": "$(ROOT)/node_modules/@agoric/import-bundle/src/compartment-wrapper", - "node_modules/@agoric/import-bundle/src/index": "$(ROOT)/node_modules/@agoric/import-bundle/src/index", - "node_modules/@agoric/marshal/marshal": "$(ROOT)/node_modules/@agoric/marshal/marshal", - "node_modules/@agoric/nat/0_MKDIR": "$(ROOT)/node_modules/@agoric/nat/0_MKDIR", - "node_modules/@agoric/nat/dist/nat.esm": "$(ROOT)/node_modules/@agoric/nat/dist/nat.esm", - "node_modules/@agoric/promise-kit/0_MKDIR": "$(ROOT)/node_modules/@agoric/promise-kit/0_MKDIR", - "node_modules/@agoric/promise-kit/src/promiseKit": "$(ROOT)/node_modules/@agoric/promise-kit/src/promiseKit", - "node_modules/@agoric/swingset-vat/0_MKDIR": "$(ROOT)/node_modules/@agoric/swingset-vat/0_MKDIR", - "node_modules/@agoric/swingset-vat/src/0_MKDIR": "$(ROOT)/node_modules/@agoric/swingset-vat/src/0_MKDIR", - "node_modules/@agoric/swingset-vat/src/capdata": "$(ROOT)/node_modules/@agoric/swingset-vat/src/capdata", - "node_modules/@agoric/swingset-vat/src/kernel/liveSlots": "$(ROOT)/node_modules/@agoric/swingset-vat/src/kernel/liveSlots", - "node_modules/@agoric/swingset-vat/src/parseVatSlots": "$(ROOT)/node_modules/@agoric/swingset-vat/src/parseVatSlots", - "packages/0_MKDIR": "$(ROOT)/packages/0_MKDIR", - "packages/xs-vat-worker/0_MKDIR": "$(ROOT)/packages/xs-vat-worker/0_MKDIR", - "packages/xs-vat-worker/src/vatWorker": "$(ROOT)/packages/xs-vat-worker/src/vatWorker" - } -} diff --git a/packages/xs-vat-worker/package.json b/packages/xs-vat-worker/package.json index 3d343d29bac..ac39a6e9cf3 100644 --- a/packages/xs-vat-worker/package.json +++ b/packages/xs-vat-worker/package.json @@ -5,6 +5,7 @@ "main": "src/locate.js", "module": "src/locate.js", "scripts": { + "install:xs-lin": "make -f xs-lin.mk install-deps", "build:xs-lin": "make -f xs-lin.mk", "test": "ava", "build": "exit 0", diff --git a/packages/xs-vat-worker/xs-lin.mk b/packages/xs-vat-worker/xs-lin.mk index dc169ef21a7..91aa9faeddf 100644 --- a/packages/xs-vat-worker/xs-lin.mk +++ b/packages/xs-vat-worker/xs-lin.mk @@ -3,6 +3,19 @@ TOOLS=$(MODDABLE)/build/bin/lin/release/ NODE_MODULES=$(PWD)/node_modules ROOT=$(PWD)/../.. +.PHONY: all + +all: + $(MAKE) -f xs-lin.mk build + @echo "### building XS tools (headless)" + $(MAKE) -f xs-lin.mk $(TOOLS)/mcconfig + @echo "### building compartmap.json" + $(MAKE) -f xs-lin.mk compartmap.json + cat compartmap.json + @echo "### building xs-worker" + ROOT=$(ROOT) PATH=$(TOOLS):$$PATH MODDABLE=$(MODDABLE) mcconfig -o build -p x-cli-lin -m -d + + build/bin/lin/debug/xs-vat-worker: build $(TOOLS)/mcconfig moddable/xs/platforms/lin_xs_cli.c compartmap.json manifest.json ROOT=$(ROOT) PATH=$(TOOLS):$$PATH MODDABLE=$(MODDABLE) mcconfig -o build -p x-cli-lin -m -d @@ -20,14 +33,19 @@ moddable/xs/platforms/lin_xs_cli.c: moddable/xs/platforms/lin_xs.h moddable/xs/platforms/lin_xs.h: /usr/include/glib-2.0/gio/gio.h +.PHONY: install-deps +install-deps: + $(MAKE) -f xs-lin.mk install-gio + .PHONY: install-gio /usr/include/glib-2.0/gio/gio.h: - @echo "GIO not installed, need root to run apt-get install libgio2.0-dev + @echo "GIO not installed, need root to run apt-get install libgio2.0-dev" @echo "feel free to stop now and run `make install-gio` directly, then rebuild" - $(MAKE) install-gio + $(MAKE) -f xs-lin.mk install-gio +# ubuntu 'bionic' puts gio in libglib2.0-dev install-gio: - sudo apt-get -y update && sudo apt-get -y install libgio2.0-dev + sudo apt-get -y update && sudo apt-get -y install libglib2.0-dev $(TOOLS)/mcconfig: cd moddable && \