Use 30 as the long distance matching window to support both 32-bit and 64-bit OS

This commit is contained in:
Aiqiao Yan 2020-05-01 14:25:15 -04:00
parent a5d9a3b1a6
commit 75cd46ec0c
5 changed files with 17 additions and 42 deletions

View file

@ -12,7 +12,6 @@ jest.mock("@actions/exec");
jest.mock("@actions/io");
const IS_WINDOWS = process.platform === "win32";
const IS_64OS = process.platform != "win32" || process.arch === "x64";
function getTempDir(): string {
return path.join(__dirname, "_temp", "tar");
@ -47,13 +46,12 @@ test("zstd extract tar", async () => {
const tarPath = IS_WINDOWS
? `${process.env["windir"]}\\System32\\tar.exe`
: "tar";
const zstdOptions = IS_64OS ? "zstd -d --long=31" : "zstd -d --long=30";
expect(execMock).toHaveBeenCalledTimes(1);
expect(execMock).toHaveBeenCalledWith(
`"${tarPath}"`,
[
"--use-compress-program",
zstdOptions,
"zstd -d --long=30",
"-xf",
IS_WINDOWS ? archivePath.replace(/\\/g, "/") : archivePath,
"-P",
@ -142,14 +140,13 @@ test("zstd create tar", async () => {
const tarPath = IS_WINDOWS
? `${process.env["windir"]}\\System32\\tar.exe`
: "tar";
const zstdOptions = IS_64OS ? "zstd -T0 --long=31" : "zstd -T0 --long=30";
expect(execMock).toHaveBeenCalledTimes(1);
expect(execMock).toHaveBeenCalledWith(
`"${tarPath}"`,
[
"--use-compress-program",
zstdOptions,
"zstd -T0 --long=30",
"-cf",
IS_WINDOWS
? CacheFilename.Zstd.replace(/\\/g, "/")