diff options
Diffstat (limited to 'test/code-cache')
-rw-r--r-- | test/code-cache/test-code-cache-generator.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/test/code-cache/test-code-cache-generator.js b/test/code-cache/test-code-cache-generator.js index a117a2e6a6..2fed3294bf 100644 --- a/test/code-cache/test-code-cache-generator.js +++ b/test/code-cache/test-code-cache-generator.js @@ -1,10 +1,10 @@ 'use strict'; -// This test verifies that the binary is compiled with code cache and the -// cache is used when built in modules are compiled. +// This test verifies the code cache generator can generate a C++ +// file that contains the code cache. This can be removed once we +// actually build that C++ file into our binary. const common = require('../common'); - const tmpdir = require('../common/tmpdir'); const { spawnSync } = require('child_process'); const assert = require('assert'); @@ -12,17 +12,29 @@ const path = require('path'); const fs = require('fs'); const readline = require('readline'); -const generator = path.join( - __dirname, '..', '..', 'tools', 'generate_code_cache.js' -); +console.log('Looking for mkcodecache executable'); +let buildDir; +const stat = fs.statSync(process.execPath); +if (stat.isSymbolicLink()) { + console.log('Binary is a symbolic link'); + buildDir = path.dirname(fs.readlinkSync(process.execPath)); +} else { + buildDir = path.dirname(process.execPath); +} + +const ext = common.isWindows ? '.exe' : ''; +const generator = path.join(buildDir, `mkcodecache${ext}`); +if (!fs.existsSync(generator)) { + common.skip('Could not find mkcodecache'); +} + +console.log(`mkcodecache is ${generator}`); + tmpdir.refresh(); const dest = path.join(tmpdir.path, 'cache.cc'); -// Run tools/generate_code_cache.js -const child = spawnSync( - process.execPath, - ['--expose-internals', generator, dest] -); +// Run mkcodecache +const child = spawnSync(generator, [dest]); assert.ifError(child.error); if (child.status !== 0) { console.log(child.stderr.toString()); |