Bump verbosity of database finalize in debug mode

This commit is contained in:
Henry Mercer
2024-03-13 18:22:37 +00:00
parent 649f3e87e1
commit 070b05147a
9 changed files with 39 additions and 15 deletions

View File

@@ -263,6 +263,7 @@ async function finalizeDatabaseCreation(
util.getCodeQLDatabasePath(config, language),
threadsFlag,
memoryFlag,
config.debugMode,
);
logger.endGroup();
}

View File

@@ -873,7 +873,7 @@ test("database finalize recognises JavaScript no code found error on CodeQL 2.11
sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(
async () => await codeqlObject.finalizeDatabase("", "", ""),
async () => await codeqlObject.finalizeDatabase("", "", "", false),
{
instanceOf: util.ConfigurationError,
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("");
await t.throwsAsync(
async () => await codeqlObject.finalizeDatabase("", "", ""),
async () => await codeqlObject.finalizeDatabase("", "", "", false),
{
instanceOf: util.ConfigurationError,
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(
async () =>
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
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". ' +
@@ -940,7 +945,12 @@ test("runTool summarizes several fatal errors", async (t) => {
await t.throwsAsync(
async () =>
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
await codeqlObject.finalizeDatabase(
"db",
"--threads=2",
"--ram=2048",
false,
),
{
instanceOf: util.ConfigurationError,
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(
async () =>
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
await codeqlObject.finalizeDatabase(
"db",
"--threads=2",
"--ram=2048",
false,
),
{
instanceOf: util.ConfigurationError,
message: new RegExp(

View File

@@ -100,6 +100,7 @@ export interface CodeQL {
databasePath: string,
threadsFlag: string,
memoryFlag: string,
enableDebugLogging: boolean,
): Promise<void>;
/**
* Run 'codeql resolve languages'.
@@ -715,6 +716,7 @@ export async function getCodeQLForCmd(
databasePath: string,
threadsFlag: string,
memoryFlag: string,
enableDebugLogging: boolean,
) {
const args = [
"database",
@@ -722,6 +724,9 @@ export async function getCodeQLForCmd(
"--finalize-dataset",
threadsFlag,
memoryFlag,
...(enableDebugLogging
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: []),
...getExtraOptionsFromEnv(["database", "finalize"]),
databasePath,
];