MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

deps/v8/tools/clusterfuzz/js_fuzzer/build_db.js:17–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15const sourceHelpers = require('./source_helpers.js');
16
17function main() {
18 Error.stackTraceLimit = Infinity;
19
20 program
21 .version('0.0.1')
22 .option('-i, --input_dir <path>', 'Input directory.')
23 .option('-o, --output_dir <path>', 'Output directory.')
24 .parse(process.argv);
25
26 if (!program.args.length) {
27 console.log('Need to specify corpora.');
28 return;
29 }
30
31 if (!program.output_dir) {
32 console.log('Need to specify output dir.');
33 return;
34 }
35
36 const mutateDb = new db.MutateDbWriter(program.output_dir);
37
38 const inputDir = path.resolve(program.input_dir);
39 for (const corpusName of program.args) {
40 const curCorpus = corpus.create(inputDir, corpusName);
41 for (const relPath of curCorpus.relFiles()) {
42 let source;
43 try {
44 source = sourceHelpers.loadSource(curCorpus, relPath);
45 } catch (e) {
46 console.log(e);
47 continue;
48 }
49
50 if (!source) {
51 continue;
52 }
53
54 try{
55 mutateDb.process(source);
56 } catch (e) {
57 console.log(e);
58 }
59 }
60 }
61
62 mutateDb.writeIndex();
63}
64
65main();

Callers 1

build_db.jsFile · 0.70

Calls 8

processMethod · 0.95
writeIndexMethod · 0.95
relFilesMethod · 0.80
parseMethod · 0.65
versionMethod · 0.45
logMethod · 0.45
resolveMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected