Rename getMemoryFlagValue

This commit is contained in:
Kasper Svendsen
2025-11-27 15:39:50 +01:00
parent 2f3bbce9a6
commit 8d91fa189d
6 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -1040,7 +1040,7 @@ const getOverlayDatabaseModeMacro = test.macro({
.stub(actionsUtil, "isAnalyzingPullRequest")
.returns(setup.isPullRequest);
sinon.stub(util, "getMemoryFlagValue").returns(setup.memoryFlagValue);
sinon.stub(util, "getCodeQLMemoryLimit").returns(setup.memoryFlagValue);
// Set up CodeQL mock
const codeql = mockCodeQLVersion(setup.codeqlVersion);
+2 -2
View File
@@ -44,7 +44,7 @@ import {
cloneObject,
isDefined,
checkDiskUsage,
getMemoryFlagValue,
getCodeQLMemoryLimit,
} from "./util";
export * from "./config/db-config";
@@ -664,7 +664,7 @@ async function runnerSupportsOverlayAnalysis(
return false;
}
const memoryFlagValue = getMemoryFlagValue(ramInput, logger);
const memoryFlagValue = getCodeQLMemoryLimit(ramInput, logger);
if (memoryFlagValue < OVERLAY_MINIMUM_MEMORY_MB) {
logger.info(
`Setting overlay database mode to ${OverlayDatabaseMode.None} ` +
+2 -2
View File
@@ -75,7 +75,7 @@ import {
codeQlVersionAtLeast,
DEFAULT_DEBUG_ARTIFACT_NAME,
DEFAULT_DEBUG_DATABASE_NAME,
getMemoryFlagValue,
getCodeQLMemoryLimit,
getRequiredEnvParam,
getThreadsFlagValue,
initializeEnvironment,
@@ -538,7 +538,7 @@ async function run() {
core.exportVariable(
"CODEQL_RAM",
process.env["CODEQL_RAM"] ||
getMemoryFlagValue(getOptionalInput("ram"), logger).toString(),
getCodeQLMemoryLimit(getOptionalInput("ram"), logger).toString(),
);
core.exportVariable(
"CODEQL_THREADS",
+5 -5
View File
@@ -309,13 +309,13 @@ function getCgroupMemoryLimitBytes(
}
/**
* Get the value of the codeql `--ram` flag as configured by the `ram` input.
* If no value was specified, the total available memory will be used minus a
* Get the maximum amount of memory CodeQL is allowed to use. If no limit has been
* configured by the user, then the total available memory will be used minus a
* threshold reserved for the OS.
*
* @returns {number} the amount of RAM to use, in megabytes
* @returns {number} the amount of RAM CodeQL is allowed to use, in megabytes
*/
export function getMemoryFlagValue(
export function getCodeQLMemoryLimit(
userInput: string | undefined,
logger: Logger,
): number {
@@ -337,7 +337,7 @@ export function getMemoryFlag(
userInput: string | undefined,
logger: Logger,
): string {
const megabytes = getMemoryFlagValue(userInput, logger);
const megabytes = getCodeQLMemoryLimit(userInput, logger);
return `--ram=${megabytes}`;
}