test: fix the llvm test

This commit is contained in:
Amin Yahyaabadi 2021-09-15 03:53:25 -05:00
parent 9e16dda2d6
commit 088b9ab277
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import { getSpecificVersionAndUrl, setupLLVM } from "../llvm" import { setupLLVM, VERSIONS, getUrl } from "../llvm"
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
import { isValidUrl } from "../../utils/http/validate_url" import { isValidUrl } from "../../utils/http/validate_url"
import { setupTmpDir, cleanupTmpDir } from "../../utils/tests/test-helpers" import { setupTmpDir, cleanupTmpDir } from "../../utils/tests/test-helpers"
import { addBinExtension } from "../../utils/setup/setupBin" import { addBinExtension } from "../../utils/setup/setupBin"
@ -7,7 +8,7 @@ import { spawnSync as spawn } from "child_process"
jest.setTimeout(200000) jest.setTimeout(200000)
async function testUrl(version: string) { async function testUrl(version: string) {
const [specificVersion, url] = await getSpecificVersionAndUrl(process.platform, version) const [specificVersion, url] = await getSpecificVersionAndUrl(VERSIONS, process.platform, version, getUrl)
if (!(await isValidUrl(url))) { if (!(await isValidUrl(url))) {
throw new Error(`Failed to install Version: ${version} => ${specificVersion} \n URL: ${url}`) throw new Error(`Failed to install Version: ${version} => ${specificVersion} \n URL: ${url}`)

View File

@ -11,7 +11,7 @@ import { getSpecificVersionAndUrl, getVersions } from "../utils/setup/version"
//================================================ //================================================
/** The specific and minimum LLVM versions supported by this action. */ /** The specific and minimum LLVM versions supported by this action. */
const VERSIONS: Set<string> = getVersions([ export const VERSIONS: Set<string> = getVersions([
"3.5.0", "3.5.0",
"3.5.1", "3.5.1",
"3.5.2", "3.5.2",
@ -199,7 +199,7 @@ async function getWin32Url(version: string): Promise<string | null> {
} }
/** Gets an LLVM download URL. */ /** Gets an LLVM download URL. */
function getUrl(platform: string, version: string): string | null | Promise<string | null> { export function getUrl(platform: string, version: string): string | null | Promise<string | null> {
switch (platform) { switch (platform) {
case "darwin": case "darwin":
return getDarwinUrl(version) return getDarwinUrl(version)