From eb23fb4cfedf368c0f1a7d002212cf084a8008b4 Mon Sep 17 00:00:00 2001 From: animetosho Date: Fri, 13 Dec 2024 21:41:00 +1000 Subject: [PATCH] Test GHA test fixes --- .github/workflows/build-dev-win64.yml | 3 +-- .github/workflows/test-full.yml | 6 +++++- test/par-compare.js | 8 +++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-dev-win64.yml b/.github/workflows/build-dev-win64.yml index 29d88c6..b8b4624 100644 --- a/.github/workflows/build-dev-win64.yml +++ b/.github/workflows/build-dev-win64.yml @@ -19,9 +19,8 @@ jobs: - run: npm install --production --ignore-scripts - run: npm install --production working-directory: nexe - # diagnose weird execution failure + # workaround issue https://github.com/nodejs/node/issues/52681#issuecomment-2076426887 - run: | - (Get-Content -Path "node_modules/nexe/lib/compiler.js" -Raw) -replace 'child_process_1.spawn', 'this.log.step(''Executing ''+command+'' ''+args);child_process_1.spawn' | Set-Content -Path "node_modules/nexe/lib/compiler.js" (Get-Content -Path "node_modules/nexe/lib/compiler.js" -Raw) -replace 'cwd: this.src,', 'shell: true, cwd: this.src,' | Set-Content -Path "node_modules/nexe/lib/compiler.js" working-directory: nexe - run: node build diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index f26c1e8..0fb681e 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -24,6 +24,7 @@ jobs: name: Test on Node v${{ matrix.version }} runs-on: ubuntu-latest steps: + - run: sudo apt-get install -y gdb - uses: MatteoH2O1999/setup-python@v2 with: python-version: '2.7' @@ -33,5 +34,8 @@ jobs: with: node-version: ${{ matrix.version }} - run: npm install --production - - run: node ${{ matrix.flags }} par-compare.js -f -v + env: + CFLAGS: -ggdb + CXXFLAGS: -ggdb + - run: node ${{ matrix.flags }} par-compare.js -f -v -d working-directory: test diff --git a/test/par-compare.js b/test/par-compare.js index d01fa0d..56a56d8 100644 --- a/test/par-compare.js +++ b/test/par-compare.js @@ -9,6 +9,7 @@ var tmpDir = (process.env.TMP || process.env.TEMP || '.') + require('path').sep; //var tmpDir = require('path').resolve('./tmp') + require('path').sep; var exeNode = 'node'; +var exeGdb = 'gdb'; // only used if native stack traces wanted var exeParpar = '../bin/parpar'; var exePar2 = 'par2'; @@ -19,6 +20,7 @@ var pruneCache = false; // prune unused keys from cached results var procArgs = process.argv.slice(2); var fastTest = procArgs.indexOf('-f') > -1; var verbose = procArgs.indexOf('-v') > -1; +var use_gdb = procArgs.indexOf('-d') > -1; var fs = require('fs'); var crypto = require('crypto'); @@ -579,14 +581,18 @@ async.timesSeries(allTests.length, function(testNum, cb) { var testFiles, refFiles; var execArgs = exeParpar ? (Array.isArray(exeParpar) ? exeParpar : [exeParpar]).concat(testArgs) : testArgs; console.log('Executing: ' + exeNode, execArgs.map(function(arg) { return '"' + arg + '"'; }).join(' ')); // arguments not properly escaped, but should be good enough for 99% of cases + if(use_gdb) { + execArgs = ['--batch', '-ex','r', '-ex','bt', '-ex','q $_exitcode', '--args', exeNode].concat(execArgs); + } var timePP, timeP2; timePP = Date.now(); - proc.execFile(exeNode, execArgs, function(err, stdout, stderr) { + proc.execFile(use_gdb ? exeGdb : exeNode, execArgs, function(err, stdout, stderr) { timePP = Date.now() - timePP; if(err) { console.error('Error occurred after ' + (timePP/1000) + '; std output: '); process.stdout.write(stdout); process.stderr.write(stderr); + console.log('Error object: ', err); throw err; }