test: test the default versions in the tests

This commit is contained in:
Amin Yahyaabadi 2022-04-16 00:54:31 -07:00
parent 00c79834f7
commit 09cdd6608c
10 changed files with 28 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,6 +1,7 @@
import { setupCmake } from "../cmake"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"
jest.setTimeout(300000)
@ -11,12 +12,12 @@ describe("setup-cmake", () => {
})
it("should setup CMake", async () => {
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
await testBin("cmake", ["--version"], binDir)
})
it("should find CMake in the cache", async () => {
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
await testBin("cmake", ["--version"], binDir)
if (isGitHubCI()) {
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")

View File

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

View File

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

View File

@ -1,6 +1,7 @@
import { setupKcov } from "../kcov"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
import { getVersion } from "../../default_versions"
jest.setTimeout(300000)
async function testKcov(version: string, directory: string) {
@ -15,10 +16,12 @@ describe("setup-Kcov", () => {
return
}
it("should setup Kcov v39", async () => {
const directory = await setupTmpDir("kcov-v39")
await testKcov("v39", directory)
await cleanupTmpDir("kcov-v39")
it("should setup Kcov", async () => {
const version = getVersion("kcov", "true")
const directory = await setupTmpDir(`kcov-${version}`)
await testKcov(version, directory)
await cleanupTmpDir(`kcov-${version}`)
})
// TODO

View File

@ -7,6 +7,7 @@ import execa from "execa"
import path from "path"
import { addBinExtension } from "../../utils/extension/extension"
import { chmodSync } from "fs"
import { getVersion } from "../../default_versions"
jest.setTimeout(400000)
async function testUrl(version: string) {
@ -26,6 +27,7 @@ describe("setup-llvm", () => {
it("Finds valid LLVM URLs", async () => {
await Promise.all(
[
"14.0.1",
"14.0.0",
"13.0.0",
"12.0.0",
@ -49,7 +51,7 @@ describe("setup-llvm", () => {
})
it("should setup LLVM", async () => {
const { binDir } = await setupLLVM("13.0.0", directory, process.arch)
const { binDir } = await setupLLVM(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang++", ["--version"], binDir)
expect(process.env.CC?.includes("clang")).toBeTruthy()
@ -66,7 +68,7 @@ describe("setup-llvm", () => {
})
it("should find llvm in the cache", async () => {
const { binDir } = await setupLLVM("13.0.0", directory, process.arch)
const { binDir } = await setupLLVM(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang++", ["--version"], binDir)
if (isGitHubCI()) {
@ -83,7 +85,7 @@ describe("setup-llvm", () => {
})
it("should setup clang-tidy and clang-format", async () => {
const { binDir } = await setupClangTools("13.0.0", directory, process.arch)
const { binDir } = await setupClangTools(getVersion("llvm", "true"), directory, process.arch)
await testBin("clang-tidy", ["--version"], binDir)
await testBin("clang-format", ["--version"], binDir)
})

View File

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

View File

@ -1,10 +1,11 @@
import { setupNinja } from "../ninja"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"
jest.setTimeout(300000)
async function testNinja(directory: string) {
const { binDir } = await setupNinja("1.10.2", directory, process.arch)
const { binDir } = await setupNinja(getVersion("ninja", "true"), directory, process.arch)
await testBin("ninja", ["--version"], binDir)
return binDir
}

View File

@ -1,6 +1,7 @@
import { setupTask } from "../task"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { isGitHubCI } from "../../utils/env/isci"
import { getVersion } from "../../default_versions"
jest.setTimeout(300000)
describe("setup-task", () => {
@ -10,13 +11,13 @@ describe("setup-task", () => {
})
it("should setup task", async () => {
const { binDir } = await setupTask("3.10.0", directory, process.arch)
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)
await testBin("task", ["--version"], binDir)
})
it("should find task in the cache", async () => {
const { binDir } = await setupTask("3.10.0", directory, process.arch)
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)
if (isGitHubCI()) {
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
}