mirror of
https://github.com/LisherSong/ps5-web-file-manager.git
synced 2026-10-06 07:00:28 +02:00
test(rar): keep real fixtures in fixtures-real/ (make_fixtures wipes fixtures/)
tests/make_fixtures.py rmtree()s tests/fixtures on every run-tests.sh invocation, silently deleting the real RAR fixtures. The WinRAR generator now writes tests/fixtures-real/; run-tests.sh passes it as a third argument to test-rar-extract, which resolves v6/volume/encrypted checks against it and falls back to SKIP when absent.
This commit is contained in:
1 parent
22a4b5c76a
commit
30d0decf58
3 files changed
+24
-9
No files matched your search
@@ -1,8 +1,9 @@
|
||||
@echo off
|
||||
REM Generate real RAR fixtures for the v1.9 host test suite.
|
||||
REM Requires WinRAR command-line Rar.exe (ships with normal WinRAR install).
|
||||
REM Outputs into tests\fixtures\ - rerun any time fixture needs change.
|
||||
REM NOTE: keep this file pure ASCII (cmd.exe uses the ANSI codepage).
|
||||
REM Outputs into tests\fixtures-real\ - kept OUT of tests\fixtures\ because
|
||||
REM tests\make_fixtures.py wipes that directory on every test run.
|
||||
REM Rerun any time fixture needs change. NOTE: keep this file pure ASCII.
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set RAREXE=
|
||||
@@ -16,7 +17,9 @@ if "%RAREXE%"=="" (
|
||||
echo Using: %RAREXE%
|
||||
"%RAREXE%" 2>nul | findstr /c:"RAR " >nul || (echo [ERROR] %RAREXE% does not look like WinRAR & exit /b 1)
|
||||
|
||||
set FIX=%~dp0fixtures
|
||||
set FIX=%~dp0fixtures-real
|
||||
if exist "%FIX%" rmdir /s /q "%FIX%"
|
||||
mkdir "%FIX%"
|
||||
set STAGE=%~dp0fixture-stage
|
||||
if exist "%STAGE%" rmdir /s /q "%STAGE%"
|
||||
mkdir "%STAGE%\dir" 2>nul
|
||||
|
||||
+5
-1
@@ -96,4 +96,8 @@ RAR_LIBS=()
|
||||
"$BUILD/zip_extract.o" "${objs[@]}" "${rar_objs[@]}" "${RAR_LIBS[@]}"
|
||||
|
||||
"$BUILD/test-zip-extract" "$ROOT/tests/fixtures" "$BUILD/work-zip"
|
||||
"$BUILD/test-rar-extract" "$ROOT/tests/fixtures" "$BUILD/work-rar"
|
||||
# Real RAR fixtures (v6 / multi-volume / encrypted) live in fixtures-real/,
|
||||
# generated by tests/make-rar-fixtures.bat (WinRAR required); fixtures/
|
||||
# itself is wiped by make_fixtures.py on every run.
|
||||
"$BUILD/test-rar-extract" "$ROOT/tests/fixtures" "$BUILD/work-rar" \
|
||||
"$ROOT/tests/fixtures-real"
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "posix_compat.h"
|
||||
|
||||
static const char *g_fixtures;
|
||||
static const char *g_fixtures_real;
|
||||
static char g_work[4096];
|
||||
static int g_failures;
|
||||
static int g_checks;
|
||||
@@ -37,6 +38,11 @@ fixture_path(char *out, size_t size, const char *name) {
|
||||
snprintf(out, size, "%s/%s", g_fixtures, name);
|
||||
}
|
||||
|
||||
static void
|
||||
fixture_real_path(char *out, size_t size, const char *name) {
|
||||
snprintf(out, size, "%s/%s", g_fixtures_real, name);
|
||||
}
|
||||
|
||||
static void
|
||||
work_path(char *out, size_t size, const char *name) {
|
||||
snprintf(out, size, "%s/%s", g_work, name);
|
||||
@@ -315,7 +321,7 @@ test_real_archives(void) {
|
||||
zipx_result_t res;
|
||||
zipx_status_t st;
|
||||
char src[4096];
|
||||
fixture_path(src, sizeof(src), "basic-v6.rar");
|
||||
fixture_real_path(src, sizeof(src), "basic-v6.rar");
|
||||
if(exists(src)) {
|
||||
memset(&res, 0, sizeof(res));
|
||||
st = rar_extract(src, dst, ZIPX_CONFLICT_FAIL,
|
||||
@@ -343,7 +349,7 @@ test_real_archives(void) {
|
||||
zipx_result_t res;
|
||||
zipx_status_t st;
|
||||
char src[4096];
|
||||
fixture_path(src, sizeof(src), "basic-rar4.rar");
|
||||
fixture_real_path(src, sizeof(src), "basic-rar4.rar");
|
||||
if(exists(src)) {
|
||||
memset(&res, 0, sizeof(res));
|
||||
st = rar_extract(src, dst, ZIPX_CONFLICT_FAIL,
|
||||
@@ -369,7 +375,7 @@ test_real_archives(void) {
|
||||
zipx_result_t res;
|
||||
zipx_status_t st;
|
||||
char src[4096];
|
||||
fixture_path(src, sizeof(src), "vol.part1.rar");
|
||||
fixture_real_path(src, sizeof(src), "vol.part1.rar");
|
||||
if(exists(src)) {
|
||||
memset(&res, 0, sizeof(res));
|
||||
st = rar_extract(src, dst, ZIPX_CONFLICT_FAIL,
|
||||
@@ -396,7 +402,7 @@ test_real_archives(void) {
|
||||
zipx_result_t res;
|
||||
zipx_status_t st;
|
||||
char src[4096];
|
||||
fixture_path(src, sizeof(src), "enc-v6.rar");
|
||||
fixture_real_path(src, sizeof(src), "enc-v6.rar");
|
||||
if(exists(src)) {
|
||||
memset(&res, 0, sizeof(res));
|
||||
st = rar_extract(src, dst, ZIPX_CONFLICT_FAIL,
|
||||
@@ -416,10 +422,12 @@ test_real_archives(void) {
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
if(argc < 3) {
|
||||
fprintf(stderr, "usage: %s <fixtures-dir> <work-dir>\n", argv[0]);
|
||||
fprintf(stderr, "usage: %s <fixtures-dir> <work-dir> [real-fixtures-dir]\n",
|
||||
argv[0]);
|
||||
return 2;
|
||||
}
|
||||
g_fixtures = argv[1];
|
||||
g_fixtures_real = (argc >= 4) ? argv[3] : argv[1];
|
||||
snprintf(g_work, sizeof(g_work), "%s", argv[2]);
|
||||
mkdir(g_work, 0777);
|
||||
|
||||
|
||||
Reference in new issue
Block a user