test: pass process.arch in the setupBin tests

This commit is contained in:
Amin Yahyaabadi 2022-01-30 16:01:13 -08:00
parent d3d6f6195e
commit f9ff833979
7 changed files with 21 additions and 12 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

@ -10,12 +10,12 @@ describe("setup-cmake", () => {
})
it("should setup CMake", async () => {
const { binDir } = await setupCmake("3.20.2", directory, "")
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
await testBin("cmake", ["--version"], binDir)
})
it("should find CMake in the cache", async () => {
const { binDir } = await setupCmake("3.20.2", directory, "")
const { binDir } = await setupCmake("3.20.2", directory, process.arch)
await testBin("cmake", ["--version"], binDir)
expect(binDir.includes("ToolCache")).toBeTruthy()
})

View File

@ -42,7 +42,7 @@ describe("setup-llvm", () => {
})
it("should setup LLVM", async () => {
const { binDir } = await setupLLVM("11.0.0", directory, "")
const { binDir } = await setupLLVM("11.0.0", directory, process.arch)
await testBin("clang++", ["--version"], binDir)
expect(process.env.CC?.includes("clang")).toBeTruthy()
@ -50,7 +50,7 @@ describe("setup-llvm", () => {
})
it("should find llvm in the cache", async () => {
const { binDir } = await setupLLVM("11.0.0", directory, "")
const { binDir } = await setupLLVM("11.0.0", directory, process.arch)
await testBin("clang++", ["--version"], binDir)
expect(binDir.includes("ToolCache")).toBeTruthy()
@ -62,12 +62,12 @@ describe("setup-llvm", () => {
})
it("should setup clang-tidy and clang-format", async () => {
const { binDir } = await setupClangTools("11.0.0", directory, "")
const { binDir } = await setupClangTools("11.0.0", directory, process.arch)
await testBin("clang-tidy", ["--version"], binDir)
await testBin("clang-format", ["--version"], binDir)
})
afterAll(async () => {
await cleanupTmpDir("setup-llvm")
await cleanupTmpDir("llvm")
}, 100000)
})

View File

@ -3,7 +3,7 @@ import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-help
jest.setTimeout(300000)
async function testNinja(directory: string) {
const { binDir } = await setupNinja("1.10.2", directory, "")
const { binDir } = await setupNinja("1.10.2", directory, process.arch)
await testBin("ninja", ["--version"], binDir)
return binDir
}
@ -24,6 +24,6 @@ describe("setup-ninja", () => {
})
afterEach(async () => {
await cleanupTmpDir("setup-ninja")
await cleanupTmpDir("ninja")
}, 100000)
})

View File

@ -1,5 +1,5 @@
import { setupTask } from "../task"
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(300000)
@ -14,4 +14,13 @@ describe("setup-task", () => {
await testBin("task", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
})
it("should find task in the cache", async () => {
const installInfo = await setupTask("3.10.0", directory, process.arch)
expect((installInfo as InstallationInfo | undefined)?.binDir.includes("ToolCache")).toBeTruthy()
})
afterEach(async () => {
await cleanupTmpDir("task")
}, 100000)
})

View File

@ -62,7 +62,7 @@ export async function setupBin(
const installDir = join(dir, extractedFolderName)
const binDir = join(installDir, binRelativeDir)
if (existsSync(binDir) && existsSync(join(binDir, binFileName))) {
info(`${name} ${version} was found in the cache.`)
info(`${name} ${version} was found in the cache at ${binDir}.`)
addPath(binDir)
return { installDir, binDir }
}