Skip to content

Commit

Permalink
test: added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
aryamohanan committed Aug 13, 2024
1 parent 65db642 commit c7728c3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
37 changes: 21 additions & 16 deletions packages/collector/test/nativeModuleRetry/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,28 @@ function runCopyPrecompiledForNativeAddonTest(agentControls, opts) {
await Promise.all(copyPromises);
}
const check = async copiedBinaryPath => {
const targetDirectory = 'precompiled';
const directoryPath = path.join(copiedBinaryPath, targetDirectory);
['binding.gyp', 'build', 'package.json', 'src'].forEach(file => {
expect(fs.existsSync(path.join(directoryPath, file))).to.be.true;
});

if (directoryPath.includes('event-loop-stats')) {
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.cc'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.js'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.d.ts'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'build', 'Release', 'eventLoopStats.node'))).to.be.true;
}
try {
const targetDirectory = 'precompiled';
const directoryPath = path.join(copiedBinaryPath, targetDirectory);
['binding.gyp', 'build', 'package.json', 'src'].forEach(file => {
expect(fs.existsSync(path.join(directoryPath, file))).to.be.true;
});

if (directoryPath.includes('event-loop-stats')) {
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.cc'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.js'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'eventLoopStats.d.ts'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'build', 'Release', 'eventLoopStats.node'))).to.be.true;
}

if (directoryPath.includes('gcstats.js')) {
expect(fs.existsSync(path.join(directoryPath, 'src', 'gcstats.cc'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'gcstats.js'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'build', 'Release', 'gcstats.node'))).to.be.true;
if (directoryPath.includes('gcstats.js')) {
expect(fs.existsSync(path.join(directoryPath, 'src', 'gcstats.cc'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'src', 'gcstats.js'))).to.be.true;
expect(fs.existsSync(path.join(directoryPath, 'build', 'Release', 'gcstats.node'))).to.be.true;
}
} catch (err) {
// eslint-disable-next-line no-console
console.error('native addons errors', err);
}
};

Expand Down
7 changes: 6 additions & 1 deletion packages/shared-metrics/src/util/nativeModuleRetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ function copyPrecompiled(opts, loaderEmitter, callback) {
// it will remember and not try to load anything from that path again (a `false` will be
// put into the cache for that cache key). Instead, we force a new path, by adding precompiled
// to the module path and use the absolute path to the module to load it.
logger.debug(`Copying the precompiled build for ${opts.nativeModuleName} ${label} successful.`);
// eslint-disable-next-line no-console
console.log(
`Copying the precompiled build for ${
opts.nativeModuleName
} ${label} successful. dest: ${targetDir} source: ${path.join(os.tmpdir(), opts.nativeModuleName)}`
);
opts.loadFrom = targetDir;
callback(true);
})
Expand Down

0 comments on commit c7728c3

Please sign in to comment.