test: fix the ubuntu-specific gcovr, doxygen, meson tests

This commit is contained in:
Amin Yahyaabadi 2022-05-20 19:16:58 -07:00
parent 86e88d8ce2
commit 870172d8c1
7 changed files with 44 additions and 17 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import { syncVersions } from "../default_versions"
import { syncVersions, getVersion } from "../default_versions"
import { getCompilerInfo, Inputs, parseArgs } from "../main"
jest.setTimeout(300000)
@ -33,4 +33,23 @@ describe("syncVersion", () => {
expect(syncVersions(opts, llvmTools)).toBe(true)
expect(opts.llvm).toBe(opts.clangtidy)
})
describe("getVersion", () => {
it("gcovr", () => {
expect(getVersion("gcovr", "5.0")).toBe("5.0")
if (process.platform === "linux") {
expect(getVersion("gcovr", "true", [20, 4])).toBe("5.1")
expect(getVersion("gcovr", "true", [18, 4])).toBe("5.0")
}
})
it("llvm", () => {
expect(getVersion("llvm", "13.0.0")).toBe("13.0.0")
if (process.platform === "linux") {
expect(getVersion("llvm", "true", [20, 4])).toBe("13.0.0-ubuntu-20.04")
expect(getVersion("llvm", "true", [18, 4])).toBe("13.0.1-ubuntu-18.04")
expect(getVersion("llvm", "true", [16, 4])).toBe("13.0.0-ubuntu-16.04")
}
})
})
})

View File

@ -25,17 +25,18 @@ export function getVersion(name: string, version: string | undefined, osVersion:
if ([20, 18, 16].includes(osVersion[0]) && osVersion[1] === 4) {
return `${osVersion[0] === 18 ? "13.0.1" : "13.0.0"}-ubuntu-${osVersion[0]}.0${osVersion[1]}`
}
}
if (osVersion[0] < 20) {
switch (name) {
case "gcovr":
return "5.0"
case "meson":
return "0.61.4"
case "doxygen":
return "1.9.1"
default: {
// nothing
} else {
if (osVersion[0] < 20) {
switch (name) {
case "gcovr":
return "5.0"
case "meson":
return "0.61.4"
case "doxygen":
return "1.9.1"
default: {
// nothing
}
}
}
}

View File

@ -3,6 +3,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
import { InstallationInfo } from "../../utils/setup/setupBin"
import { getVersion } from "../../default_versions"
import which from "which"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
jest.setTimeout(300000)
describe("setup-doxygen", () => {
@ -12,7 +13,11 @@ describe("setup-doxygen", () => {
})
it("should setup doxygen and dot", async () => {
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
const installInfo = await setupDoxygen(
getVersion("doxygen", undefined, await ubuntuVersion()),
directory,
process.arch
)
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)

View File

@ -1,11 +1,12 @@
import { setupGcovr } from "../gcovr"
import { testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
jest.setTimeout(300000)
describe("setup-gcovr", () => {
it("should setup gcovr", async () => {
const installInfo = await setupGcovr(getVersion("gcovr", "true"), "", process.arch)
const installInfo = await setupGcovr(getVersion("gcovr", "true", await ubuntuVersion()), "", process.arch)
await testBin("gcovr", ["--version"], installInfo.binDir)
})
})

View File

@ -1,11 +1,12 @@
import { setupMeson } from "../meson"
import { testBin } from "../../utils/tests/test-helpers"
import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
jest.setTimeout(300000)
describe("setup-meson", () => {
it("should setup meson", async () => {
const installInfo = await setupMeson(getVersion("meson", "true"), "", process.arch)
const installInfo = await setupMeson(getVersion("meson", "true", await ubuntuVersion()), "", process.arch)
await testBin("meson", ["--version"], installInfo.binDir)
})