test: add tests for llvm installation

This commit is contained in:
Amin Yahyaabadi 2021-09-14 10:00:59 -05:00
parent 096cd4150c
commit 5f56aa2e49
1 changed files with 27 additions and 1 deletions

View File

@ -1,5 +1,9 @@
import { getSpecificVersionAndUrl } from "../llvm"
import { getSpecificVersionAndUrl, setupLLVM } from "../llvm"
import { isValidUrl } from "../../utils/http/validate_url"
import { setupTmpDir, cleanupTmpDir } from "../../utils/tests/test-helpers"
import { addBinExtension } from "../../utils/setup/setupBin"
import { join } from "path"
import { spawnSync as spawn } from "child_process"
jest.setTimeout(100000)
@ -34,4 +38,26 @@ describe("setup-llvm", () => {
].map((version) => testUrl(version))
)
})
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("setup-llvm")
})
afterAll(async () => {
await cleanupTmpDir("setup-llvm")
}, 100000)
it("should setup LLVM", async () => {
const { binDir } = await setupLLVM("12.0.0", directory)
expect(binDir).toBeDefined()
expect(binDir).not.toHaveLength(0)
const clangBin = join(binDir, addBinExtension("clang"))
const { status } = spawn(clangBin, ["--version"], {
encoding: "utf8",
})
expect(status).toBe(0)
})
})