test: fix the mingw setupDir

This commit is contained in:
Amin Yahyaabadi 2022-05-20 17:07:25 -07:00
parent c667a3fe8e
commit 97b65fabfc
5 changed files with 15 additions and 6 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

@ -1,4 +1,4 @@
import { testBin } from "../../utils/tests/test-helpers" import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { setupGcc } from "../gcc" import { setupGcc } from "../gcc"
import { getVersion } from "../../default_versions" import { getVersion } from "../../default_versions"
import path from "path" import path from "path"
@ -8,9 +8,14 @@ import { chmodSync } from "fs"
jest.setTimeout(3000000) jest.setTimeout(3000000)
describe("setup-gcc", () => { describe("setup-gcc", () => {
let directory: string
beforeAll(async () => {
directory = await setupTmpDir("doxygen")
})
it("should setup gcc", async () => { it("should setup gcc", async () => {
const version = getVersion("gcc", undefined) || "11" const version = getVersion("gcc", undefined)
const installInfo = await setupGcc(version, "", process.arch) const installInfo = await setupGcc(version, directory, process.arch)
let gpp = "g++" let gpp = "g++"
if (process.platform !== "win32") { if (process.platform !== "win32") {
@ -30,4 +35,8 @@ describe("setup-gcc", () => {
} }
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" }) execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
}) })
afterAll(async () => {
await cleanupTmpDir("doxygen")
}, 100000)
}) })

BIN
src/gcc/__tests__/main.exe Normal file

Binary file not shown.

View File

@ -44,7 +44,7 @@ function getGccPackageInfo(version: string, platform: NodeJS.Platform, arch: str
const mingwArch = arch === "ia32" ? "i686" : "x86_64" const mingwArch = arch === "ia32" ? "i686" : "x86_64"
const exceptionModel: "seh" | "dwarf" = "seh" // SEH is native windows exception model https://github.com/brechtsanders/winlibs_mingw/issues/4#issuecomment-599296483 const exceptionModel: "seh" | "dwarf" = "seh" // SEH is native windows exception model https://github.com/brechtsanders/winlibs_mingw/issues/4#issuecomment-599296483
return { return {
binRelativeDir: "./bin", binRelativeDir: "bin/",
binFileName: addBinExtension("g++"), binFileName: addBinExtension("g++"),
extractedFolderName: "mingw64", extractedFolderName: "mingw64",
extractFunction: extract7Zip, extractFunction: extract7Zip,