Bump verbosity of database finalize in debug mode
This commit is contained in:
parent
649f3e87e1
commit
070b05147a
9 changed files with 39 additions and 15 deletions
2
lib/analyze.js
generated
2
lib/analyze.js
generated
|
|
@ -138,7 +138,7 @@ async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger.startGroup(`Finalizing ${language}`);
|
logger.startGroup(`Finalizing ${language}`);
|
||||||
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag, memoryFlag);
|
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag, memoryFlag, config.debugMode);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
5
lib/codeql.js
generated
5
lib/codeql.js
generated
|
|
@ -383,13 +383,16 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||||
util.getCodeQLDatabasePath(config, language),
|
util.getCodeQLDatabasePath(config, language),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
|
async finalizeDatabase(databasePath, threadsFlag, memoryFlag, enableDebugLogging) {
|
||||||
const args = [
|
const args = [
|
||||||
"database",
|
"database",
|
||||||
"finalize",
|
"finalize",
|
||||||
"--finalize-dataset",
|
"--finalize-dataset",
|
||||||
threadsFlag,
|
threadsFlag,
|
||||||
memoryFlag,
|
memoryFlag,
|
||||||
|
...(enableDebugLogging
|
||||||
|
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
|
||||||
|
: []),
|
||||||
...getExtraOptionsFromEnv(["database", "finalize"]),
|
...getExtraOptionsFromEnv(["database", "finalize"]),
|
||||||
databasePath,
|
databasePath,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
10
lib/codeql.test.js
generated
10
lib/codeql.test.js
generated
|
|
@ -553,7 +553,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", "", false), {
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp("No code found during the build\\. Please see: " +
|
message: new RegExp("No code found during the build\\. Please see: " +
|
||||||
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
|
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
|
||||||
|
|
@ -565,7 +565,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", "", false), {
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp("No code found during the build\\. Please see: " +
|
message: new RegExp("No code found during the build\\. Please see: " +
|
||||||
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
|
"https://gh\\.io/troubleshooting-code-scanning/no-source-code-seen-during-build\\."),
|
||||||
|
|
@ -579,7 +579,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
|
||||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||||
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
|
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
|
||||||
});
|
});
|
||||||
|
|
@ -594,7 +594,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
||||||
`Exit code was 32 and error was: ${datasetImportError.replaceAll(".", "\\.")}\\. Context: ${heapError.replaceAll(".", "\\.")}\\. See the logs for more details\\.`),
|
`Exit code was 32 and error was: ${datasetImportError.replaceAll(".", "\\.")}\\. Context: ${heapError.replaceAll(".", "\\.")}\\. See the logs for more details\\.`),
|
||||||
|
|
@ -607,7 +607,7 @@ for (const { codeqlVersion, flagPassed, githubVersion, negativeFlagPassed, } of
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048", false), {
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
message: new RegExp('Encountered a fatal error while running \\"codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db\\"\\. ' +
|
||||||
"Exit code was 32 and last log line was: line5\\. See the logs for more details\\."),
|
"Exit code was 32 and last log line was: line5\\. See the logs for more details\\."),
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -263,6 +263,7 @@ async function finalizeDatabaseCreation(
|
||||||
util.getCodeQLDatabasePath(config, language),
|
util.getCodeQLDatabasePath(config, language),
|
||||||
threadsFlag,
|
threadsFlag,
|
||||||
memoryFlag,
|
memoryFlag,
|
||||||
|
config.debugMode,
|
||||||
);
|
);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -873,7 +873,7 @@ test("database finalize recognises JavaScript no code found error on CodeQL 2.11
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () => await codeqlObject.finalizeDatabase("", "", ""),
|
async () => await codeqlObject.finalizeDatabase("", "", "", false),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp(
|
message: new RegExp(
|
||||||
|
|
@ -892,7 +892,7 @@ test("database finalize overrides no code found error on CodeQL 2.11.6", async (
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () => await codeqlObject.finalizeDatabase("", "", ""),
|
async () => await codeqlObject.finalizeDatabase("", "", "", false),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp(
|
message: new RegExp(
|
||||||
|
|
@ -915,7 +915,12 @@ test("database finalize does not override no code found error on CodeQL 2.12.4",
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () =>
|
async () =>
|
||||||
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
|
await codeqlObject.finalizeDatabase(
|
||||||
|
"db",
|
||||||
|
"--threads=2",
|
||||||
|
"--ram=2048",
|
||||||
|
false,
|
||||||
|
),
|
||||||
{
|
{
|
||||||
message:
|
message:
|
||||||
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||||
|
|
@ -940,7 +945,12 @@ test("runTool summarizes several fatal errors", async (t) => {
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () =>
|
async () =>
|
||||||
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
|
await codeqlObject.finalizeDatabase(
|
||||||
|
"db",
|
||||||
|
"--threads=2",
|
||||||
|
"--ram=2048",
|
||||||
|
false,
|
||||||
|
),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp(
|
message: new RegExp(
|
||||||
|
|
@ -967,7 +977,12 @@ test("runTool outputs last line of stderr if fatal error could not be found", as
|
||||||
|
|
||||||
await t.throwsAsync(
|
await t.throwsAsync(
|
||||||
async () =>
|
async () =>
|
||||||
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
|
await codeqlObject.finalizeDatabase(
|
||||||
|
"db",
|
||||||
|
"--threads=2",
|
||||||
|
"--ram=2048",
|
||||||
|
false,
|
||||||
|
),
|
||||||
{
|
{
|
||||||
instanceOf: util.ConfigurationError,
|
instanceOf: util.ConfigurationError,
|
||||||
message: new RegExp(
|
message: new RegExp(
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ export interface CodeQL {
|
||||||
databasePath: string,
|
databasePath: string,
|
||||||
threadsFlag: string,
|
threadsFlag: string,
|
||||||
memoryFlag: string,
|
memoryFlag: string,
|
||||||
|
enableDebugLogging: boolean,
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Run 'codeql resolve languages'.
|
* Run 'codeql resolve languages'.
|
||||||
|
|
@ -715,6 +716,7 @@ export async function getCodeQLForCmd(
|
||||||
databasePath: string,
|
databasePath: string,
|
||||||
threadsFlag: string,
|
threadsFlag: string,
|
||||||
memoryFlag: string,
|
memoryFlag: string,
|
||||||
|
enableDebugLogging: boolean,
|
||||||
) {
|
) {
|
||||||
const args = [
|
const args = [
|
||||||
"database",
|
"database",
|
||||||
|
|
@ -722,6 +724,9 @@ export async function getCodeQLForCmd(
|
||||||
"--finalize-dataset",
|
"--finalize-dataset",
|
||||||
threadsFlag,
|
threadsFlag,
|
||||||
memoryFlag,
|
memoryFlag,
|
||||||
|
...(enableDebugLogging
|
||||||
|
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
|
||||||
|
: []),
|
||||||
...getExtraOptionsFromEnv(["database", "finalize"]),
|
...getExtraOptionsFromEnv(["database", "finalize"]),
|
||||||
databasePath,
|
databasePath,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue