mirror of https://github.com/aminya/setup-cpp
fix: fix the llvm 15 link for linux + test the installation
This commit is contained in:
parent
41ac067e60
commit
f4e3f220db
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -122,6 +122,25 @@ describe("setup-llvm", () => {
|
||||||
await testBin("clang-format", ["--version"], binDir)
|
await testBin("clang-format", ["--version"], binDir)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should setup LLVM 15.0.2", async () => {
|
||||||
|
await cleanupTmpDir("llvm")
|
||||||
|
|
||||||
|
const { binDir } = await setupLLVM("15.0.2", directory, process.arch)
|
||||||
|
await testBin("clang++", ["--version"], binDir)
|
||||||
|
|
||||||
|
expect(process.env.CC?.includes("clang")).toBeTruthy()
|
||||||
|
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
||||||
|
|
||||||
|
// test compilation
|
||||||
|
const file = path.join(__dirname, "main.cpp")
|
||||||
|
const main_exe = path.join(__dirname, addExeExt("main"))
|
||||||
|
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
chmodSync(main_exe, "755")
|
||||||
|
}
|
||||||
|
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await cleanupTmpDir("llvm")
|
await cleanupTmpDir("llvm")
|
||||||
}, 100000)
|
}, 100000)
|
||||||
|
|
|
@ -214,8 +214,8 @@ export function getLinuxUrl(versionGiven: string): string {
|
||||||
let suffix: string
|
let suffix: string
|
||||||
if (version === "5.0.0") {
|
if (version === "5.0.0") {
|
||||||
suffix = `-linux-x86_64${linuxVersion}.tar.xz`
|
suffix = `-linux-x86_64${linuxVersion}.tar.xz`
|
||||||
} else if (version === "15.0.2") {
|
} else if (linuxVersion.includes("-rhel86")) {
|
||||||
suffix = `x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
|
suffix = `-x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
|
||||||
} else {
|
} else {
|
||||||
suffix = `-x86_64-linux-gnu${linuxVersion}.tar.xz`
|
suffix = `-x86_64-linux-gnu${linuxVersion}.tar.xz`
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,20 +47,31 @@ export async function getSpecificVersionAndUrl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the given set doesn't include the version, throw an error
|
||||||
if (!versions.has(version)) {
|
if (!versions.has(version)) {
|
||||||
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const offlineUrls: string[] = []
|
||||||
|
|
||||||
for (const specificVersion of getSpecificVersions(versions, version)) {
|
for (const specificVersion of getSpecificVersions(versions, version)) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const url = await getUrl(platform, specificVersion)
|
const url = await getUrl(platform, specificVersion)
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (url !== null && (await isUrlOnline(url))) {
|
if (url !== null) {
|
||||||
|
if (await isUrlOnline(url)) {
|
||||||
return [specificVersion, url]
|
return [specificVersion, url]
|
||||||
|
} else {
|
||||||
|
offlineUrls.push(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
throw new Error(
|
||||||
|
`Unsupported target! (platform='${platform}', version='${version}'). The offline urls tested:\n${offlineUrls.join(
|
||||||
|
"\n"
|
||||||
|
)}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultVersionRegex = /v?(\d\S*)/
|
export const defaultVersionRegex = /v?(\d\S*)/
|
||||||
|
|
Loading…
Reference in New Issue