Skip to content

Commit 870172d

Browse files
committed
test: fix the ubuntu-specific gcovr, doxygen, meson tests
1 parent 86e88d8 commit 870172d

File tree

7 files changed

+44
-17
lines changed

7 files changed

+44
-17
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/main.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { syncVersions } from "../default_versions"
1+
import { syncVersions, getVersion } from "../default_versions"
22
import { getCompilerInfo, Inputs, parseArgs } from "../main"
33

44
jest.setTimeout(300000)
@@ -33,4 +33,23 @@ describe("syncVersion", () => {
3333
expect(syncVersions(opts, llvmTools)).toBe(true)
3434
expect(opts.llvm).toBe(opts.clangtidy)
3535
})
36+
37+
describe("getVersion", () => {
38+
it("gcovr", () => {
39+
expect(getVersion("gcovr", "5.0")).toBe("5.0")
40+
if (process.platform === "linux") {
41+
expect(getVersion("gcovr", "true", [20, 4])).toBe("5.1")
42+
expect(getVersion("gcovr", "true", [18, 4])).toBe("5.0")
43+
}
44+
})
45+
46+
it("llvm", () => {
47+
expect(getVersion("llvm", "13.0.0")).toBe("13.0.0")
48+
if (process.platform === "linux") {
49+
expect(getVersion("llvm", "true", [20, 4])).toBe("13.0.0-ubuntu-20.04")
50+
expect(getVersion("llvm", "true", [18, 4])).toBe("13.0.1-ubuntu-18.04")
51+
expect(getVersion("llvm", "true", [16, 4])).toBe("13.0.0-ubuntu-16.04")
52+
}
53+
})
54+
})
3655
})

src/default_versions.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ export function getVersion(name: string, version: string | undefined, osVersion:
2525
if ([20, 18, 16].includes(osVersion[0]) && osVersion[1] === 4) {
2626
return `${osVersion[0] === 18 ? "13.0.1" : "13.0.0"}-ubuntu-${osVersion[0]}.0${osVersion[1]}`
2727
}
28-
}
29-
if (osVersion[0] < 20) {
30-
switch (name) {
31-
case "gcovr":
32-
return "5.0"
33-
case "meson":
34-
return "0.61.4"
35-
case "doxygen":
36-
return "1.9.1"
37-
default: {
38-
// nothing
28+
} else {
29+
if (osVersion[0] < 20) {
30+
switch (name) {
31+
case "gcovr":
32+
return "5.0"
33+
case "meson":
34+
return "0.61.4"
35+
case "doxygen":
36+
return "1.9.1"
37+
default: {
38+
// nothing
39+
}
3940
}
4041
}
4142
}

src/doxygen/__tests__/doxygen.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
33
import { InstallationInfo } from "../../utils/setup/setupBin"
44
import { getVersion } from "../../default_versions"
55
import which from "which"
6+
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
67

78
jest.setTimeout(300000)
89
describe("setup-doxygen", () => {
@@ -12,7 +13,11 @@ describe("setup-doxygen", () => {
1213
})
1314

1415
it("should setup doxygen and dot", async () => {
15-
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
16+
const installInfo = await setupDoxygen(
17+
getVersion("doxygen", undefined, await ubuntuVersion()),
18+
directory,
19+
process.arch
20+
)
1621

1722
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
1823

src/gcovr/__tests__/gcovr.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { setupGcovr } from "../gcovr"
22
import { testBin } from "../../utils/tests/test-helpers"
33
import { getVersion } from "../../default_versions"
4+
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
45

56
jest.setTimeout(300000)
67
describe("setup-gcovr", () => {
78
it("should setup gcovr", async () => {
8-
const installInfo = await setupGcovr(getVersion("gcovr", "true"), "", process.arch)
9+
const installInfo = await setupGcovr(getVersion("gcovr", "true", await ubuntuVersion()), "", process.arch)
910
await testBin("gcovr", ["--version"], installInfo.binDir)
1011
})
1112
})

src/meson/__tests__/meson.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { setupMeson } from "../meson"
22
import { testBin } from "../../utils/tests/test-helpers"
33
import { getVersion } from "../../default_versions"
4+
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
45

56
jest.setTimeout(300000)
67
describe("setup-meson", () => {
78
it("should setup meson", async () => {
8-
const installInfo = await setupMeson(getVersion("meson", "true"), "", process.arch)
9+
const installInfo = await setupMeson(getVersion("meson", "true", await ubuntuVersion()), "", process.arch)
910

1011
await testBin("meson", ["--version"], installInfo.binDir)
1112
})

0 commit comments

Comments
 (0)