From 164380e1c46442ff86ba717bfcf3291e88b0e274 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Thu, 19 Oct 2023 16:21:43 +0200 Subject: [PATCH 01/11] Add support for debug builds of the fuzzer --- .github/workflows/prerelease.yaml | 2 +- packages/fuzzer/package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prerelease.yaml b/.github/workflows/prerelease.yaml index cbcdbc47..090853d2 100644 --- a/.github/workflows/prerelease.yaml +++ b/.github/workflows/prerelease.yaml @@ -56,5 +56,5 @@ jobs: run: npm install --ws=@jazzer.js/fuzzer - name: build and upload prebuilds run: > - npm run prebuild --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts }} + npm run prepack --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts }} --upload ${{secrets.GITHUB_TOKEN}} diff --git a/packages/fuzzer/package.json b/packages/fuzzer/package.json index 3b92eb6c..3805ba09 100644 --- a/packages/fuzzer/package.json +++ b/packages/fuzzer/package.json @@ -16,9 +16,10 @@ "main": "dist/fuzzer.js", "types": "dist/fuzzer.d.ts", "scripts": { - "prebuild": "prebuild --runtime napi --backend cmake-js --all --strip --verbose", + "prepack": "prebuild --runtime napi --backend cmake-js --all --strip --verbose", "install": "prebuild-install --runtime napi || npm run prebuild", - "build": "cmake-js build --out build", + "build:dev": "cmake-js configure --out build --debug && cmake-js build", + "build": "cmake-js configure --out build && cmake-js build", "format:fix": "clang-format -i *.cpp shared/*.cpp shared/*.h", "lint": "find . -path ./build -prune -type f -o -iname '*.h' -o -iname '*.cpp' | xargs clang-tidy" }, From 773c69babdbfc447d7beee5462ca63363766433d Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 10:48:52 +0200 Subject: [PATCH 02/11] Fix missed prebuild->prepack --- packages/fuzzer/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuzzer/package.json b/packages/fuzzer/package.json index 3805ba09..504cc8e8 100644 --- a/packages/fuzzer/package.json +++ b/packages/fuzzer/package.json @@ -17,7 +17,7 @@ "types": "dist/fuzzer.d.ts", "scripts": { "prepack": "prebuild --runtime napi --backend cmake-js --all --strip --verbose", - "install": "prebuild-install --runtime napi || npm run prebuild", + "install": "prebuild-install --runtime napi || npm run prepack", "build:dev": "cmake-js configure --out build --debug && cmake-js build", "build": "cmake-js configure --out build && cmake-js build", "format:fix": "clang-format -i *.cpp shared/*.cpp shared/*.h", From b7ad78ab473be41932449bc05cd806b3a2aea383 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 11:53:44 +0200 Subject: [PATCH 03/11] Set package script to -e so I can more easily see the failure in CI --- end-to-end/package-jazzer-js.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 3994b9bc..3f060371 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -1,9 +1,14 @@ #!/bin/sh +set -e -cd .. -npm install -npm run build -npm run build --workspace='@jazzer.js/fuzzer' +main() { + cd .. + npm install + npm run build + npm run build --workspace='@jazzer.js/fuzzer' + + npm pack --workspaces | sed_version_and_mv +} sed_version_and_mv() { while read data; do @@ -13,4 +18,4 @@ sed_version_and_mv() { done } -npm pack --workspaces | sed_version_and_mv +main \ No newline at end of file From a11faa5de10302bed56486e23c6fb5de32337db9 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 12:08:47 +0200 Subject: [PATCH 04/11] Add explicit prepack step --- end-to-end/package-jazzer-js.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 3f060371..4c40329f 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -6,6 +6,7 @@ main() { npm install npm run build npm run build --workspace='@jazzer.js/fuzzer' + npm run prepack --workspace='@jazzer.js/fuzzer' npm pack --workspaces | sed_version_and_mv } From 544c7ebf2b2df3e981ba8b836e7188d14ea99622 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 14:25:17 +0200 Subject: [PATCH 05/11] Time to debug in CI --- end-to-end/package-jazzer-js.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 4c40329f..d7ff810d 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/opt/homebrew/bin/bash set -e main() { @@ -8,14 +8,20 @@ main() { npm run build --workspace='@jazzer.js/fuzzer' npm run prepack --workspace='@jazzer.js/fuzzer' - npm pack --workspaces | sed_version_and_mv + local tarballs=$(npm pack --workspaces) + echo "$tarballs" + echo "$tarballs" | sed_version_and_mv } sed_version_and_mv() { while read data; do - local no_version=$(echo $data | sed -r -f end-to-end/remove-version.sed) - echo "mv $data end-to-end/$no_version" - mv $data end-to-end/$no_version + if [[ -n "$data" ]]; then + local no_version=$(echo $data | sed -r -f end-to-end/remove-version.sed) + echo "mv $data end-to-end/$no_version" + mv $data end-to-end/$no_version + else + echo "received empty line" + fi done } From cba3f91f968e9cd82f6fb071d79e2ed80486d407 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 14:26:22 +0200 Subject: [PATCH 06/11] Fix bash shebang --- end-to-end/package-jazzer-js.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index d7ff810d..357ef326 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -1,4 +1,4 @@ -#!/opt/homebrew/bin/bash +#!/usr/bin/env bash set -e main() { From d1976f50122c7ad2d76f5cc5e633a76a23febf5f Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 14:48:54 +0200 Subject: [PATCH 07/11] Is stderr going to stdout? --- end-to-end/package-jazzer-js.sh | 2 +- end-to-end/tsconfig.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 357ef326..74c9478d 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -8,7 +8,7 @@ main() { npm run build --workspace='@jazzer.js/fuzzer' npm run prepack --workspace='@jazzer.js/fuzzer' - local tarballs=$(npm pack --workspaces) + local tarballs=$(npm pack --workspaces 2> /dev/null) echo "$tarballs" echo "$tarballs" | sed_version_and_mv } diff --git a/end-to-end/tsconfig.json b/end-to-end/tsconfig.json index 7363a7c8..ba34870a 100644 --- a/end-to-end/tsconfig.json +++ b/end-to-end/tsconfig.json @@ -2,7 +2,6 @@ "compilerOptions": { "target": "ES2022", "module": "NodeNext", - "moduleResolution": "node", "allowJs": true, "rootDir": ".", "outDir": "./dist", From 653a540b89eb6b9806e5ebc7074f037f9148469e Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 14:53:16 +0200 Subject: [PATCH 08/11] Mark out the exact string more clearly --- end-to-end/package-jazzer-js.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 74c9478d..bf4b0495 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -9,7 +9,9 @@ main() { npm run prepack --workspace='@jazzer.js/fuzzer' local tarballs=$(npm pack --workspaces 2> /dev/null) - echo "$tarballs" + echo "---" + echo "'$tarballs'" + echo "---" echo "$tarballs" | sed_version_and_mv } From c2774c7f6bcc859ec7ac4ffc2f15b0929a619f82 Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 15:27:19 +0200 Subject: [PATCH 09/11] Try filtering out non-tgz lines --- end-to-end/package-jazzer-js.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index bf4b0495..091654fb 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -8,7 +8,7 @@ main() { npm run build --workspace='@jazzer.js/fuzzer' npm run prepack --workspace='@jazzer.js/fuzzer' - local tarballs=$(npm pack --workspaces 2> /dev/null) + local tarballs=$(npm pack --workspaces 2> /dev/null | grep ".tgz") echo "---" echo "'$tarballs'" echo "---" From dddc0d0b18a26f610423278dc7b95e0c84afd03d Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Mon, 23 Oct 2023 16:17:25 +0200 Subject: [PATCH 10/11] Remove debugging stuff --- end-to-end/package-jazzer-js.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 091654fb..6d3ba6c6 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -8,22 +8,15 @@ main() { npm run build --workspace='@jazzer.js/fuzzer' npm run prepack --workspace='@jazzer.js/fuzzer' - local tarballs=$(npm pack --workspaces 2> /dev/null | grep ".tgz") - echo "---" - echo "'$tarballs'" - echo "---" + local tarballs=$(npm pack --workspaces | grep ".tgz") echo "$tarballs" | sed_version_and_mv } sed_version_and_mv() { while read data; do - if [[ -n "$data" ]]; then - local no_version=$(echo $data | sed -r -f end-to-end/remove-version.sed) - echo "mv $data end-to-end/$no_version" - mv $data end-to-end/$no_version - else - echo "received empty line" - fi + local no_version=$(echo $data | sed -r -f end-to-end/remove-version.sed) + echo "mv $data end-to-end/$no_version" + mv $data end-to-end/$no_version done } From 66faae69e92f7656a07eacd670383934065528fc Mon Sep 17 00:00:00 2001 From: Brian Lewis Date: Tue, 24 Oct 2023 13:30:07 +0200 Subject: [PATCH 11/11] Change the name of the prebuild script --- .github/workflows/prerelease.yaml | 4 ++-- end-to-end/package-jazzer-js.sh | 1 - packages/fuzzer/package.json | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prerelease.yaml b/.github/workflows/prerelease.yaml index 090853d2..2f1ac19b 100644 --- a/.github/workflows/prerelease.yaml +++ b/.github/workflows/prerelease.yaml @@ -56,5 +56,5 @@ jobs: run: npm install --ws=@jazzer.js/fuzzer - name: build and upload prebuilds run: > - npm run prepack --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts }} - --upload ${{secrets.GITHUB_TOKEN}} + npm run build-native --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts + }} --upload ${{secrets.GITHUB_TOKEN}} diff --git a/end-to-end/package-jazzer-js.sh b/end-to-end/package-jazzer-js.sh index 6d3ba6c6..a178ad10 100755 --- a/end-to-end/package-jazzer-js.sh +++ b/end-to-end/package-jazzer-js.sh @@ -6,7 +6,6 @@ main() { npm install npm run build npm run build --workspace='@jazzer.js/fuzzer' - npm run prepack --workspace='@jazzer.js/fuzzer' local tarballs=$(npm pack --workspaces | grep ".tgz") echo "$tarballs" | sed_version_and_mv diff --git a/packages/fuzzer/package.json b/packages/fuzzer/package.json index b9e23ca2..4ed3fb1d 100644 --- a/packages/fuzzer/package.json +++ b/packages/fuzzer/package.json @@ -16,8 +16,8 @@ "main": "dist/fuzzer.js", "types": "dist/fuzzer.d.ts", "scripts": { - "prepack": "prebuild --runtime napi --backend cmake-js --all --strip --verbose", - "install": "prebuild-install --runtime napi || npm run prepack", + "build-native": "prebuild --runtime napi --backend cmake-js --all --strip --verbose", + "install": "prebuild-install --runtime napi || npm run build-native", "build:dev": "cmake-js configure --out build --debug && cmake-js build", "build": "cmake-js configure --out build && cmake-js build", "format:fix": "clang-format -i *.cpp shared/*.cpp shared/*.h",