Skip to content

Commit f4e3f22

Browse files
committed
fix: fix the llvm 15 link for linux + test the installation
1 parent 41ac067 commit f4e3f22

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
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/llvm/__tests__/llvm.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@ describe("setup-llvm", () => {
122122
await testBin("clang-format", ["--version"], binDir)
123123
})
124124

125+
it("should setup LLVM 15.0.2", async () => {
126+
await cleanupTmpDir("llvm")
127+
128+
const { binDir } = await setupLLVM("15.0.2", directory, process.arch)
129+
await testBin("clang++", ["--version"], binDir)
130+
131+
expect(process.env.CC?.includes("clang")).toBeTruthy()
132+
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
133+
134+
// test compilation
135+
const file = path.join(__dirname, "main.cpp")
136+
const main_exe = path.join(__dirname, addExeExt("main"))
137+
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
138+
if (process.platform !== "win32") {
139+
chmodSync(main_exe, "755")
140+
}
141+
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
142+
})
143+
125144
afterAll(async () => {
126145
await cleanupTmpDir("llvm")
127146
}, 100000)

src/llvm/llvm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ export function getLinuxUrl(versionGiven: string): string {
214214
let suffix: string
215215
if (version === "5.0.0") {
216216
suffix = `-linux-x86_64${linuxVersion}.tar.xz`
217-
} else if (version === "15.0.2") {
218-
suffix = `x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
217+
} else if (linuxVersion.includes("-rhel86")) {
218+
suffix = `-x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
219219
} else {
220220
suffix = `-x86_64-linux-gnu${linuxVersion}.tar.xz`
221221
}

src/utils/setup/version.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,31 @@ export async function getSpecificVersionAndUrl(
4747
}
4848
}
4949

50+
// if the given set doesn't include the version, throw an error
5051
if (!versions.has(version)) {
5152
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
5253
}
5354

55+
const offlineUrls: string[] = []
56+
5457
for (const specificVersion of getSpecificVersions(versions, version)) {
5558
// eslint-disable-next-line no-await-in-loop
5659
const url = await getUrl(platform, specificVersion)
5760
// eslint-disable-next-line no-await-in-loop
58-
if (url !== null && (await isUrlOnline(url))) {
59-
return [specificVersion, url]
61+
if (url !== null) {
62+
if (await isUrlOnline(url)) {
63+
return [specificVersion, url]
64+
} else {
65+
offlineUrls.push(url)
66+
}
6067
}
6168
}
6269

63-
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
70+
throw new Error(
71+
`Unsupported target! (platform='${platform}', version='${version}'). The offline urls tested:\n${offlineUrls.join(
72+
"\n"
73+
)}`
74+
)
6475
}
6576

6677
export const defaultVersionRegex = /v?(\d\S*)/

0 commit comments

Comments
 (0)