Merge pull request #137 from Team-LJY/fix/runner-work-paths
Rust 검사 결과를 작업 폴더에 모음
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
bac7486629285d0cdcc947f9fb2cc4b184a2022b
변경된 파일 25개
+387-89| @@ -3,20 +3,19 @@ | ||
| 3 | 3 | PR을 병합하기 전에 linux-desktop-2에서 아래 명령을 실행하고 검증한 커밋, 요약과 실패 또는 미실행 항목을 PR 본문에 남깁니다. 실패를 성공으로 처리하지 않습니다. |
| 4 | 4 | |
| 5 | 5 | ```sh |
| 6 | 삭제: # 최초 1회, Ubuntu의 apt 저장소에서 프로젝트 내부로 교차 도구를 준비함. | |
| 7 | 삭제: bash tests/ci/setup_windows.sh | |
| 8 | 삭제: python3 tests/ci/run_rust.py local | |
| 6 | 추가: # 작업 이름 하나로 도구, 임시 파일, 빌드 결과를 묶음. | |
| 7 | 추가: python3 tests/ci/run_rust.py local --job rust-local | |
| 9 | 8 | ``` |
| 10 | 9 | |
| 11 | 삭제: `local`은 실행기 자체 검사 후 교차 도구를 찾습니다. 도구가 없으면 `setup_windows.sh`를 실행해 프로젝트 안에 최초 준비하므로 네트워크와 아래 준비 도구가 필요합니다. 준비 실패는 결과 JSON에 `tool-setup` 실패로 남깁니다. 준비된 도구가 있으면 다시 다운로드하지 않습니다. 이후 Linux 전체 빌드, Linux Rust 시험, Windows 교차 빌드를 순서대로 수행합니다. 단계별 통과/실패/비해당 개수를 출력하고 `tests/ci/local-results.json`에 검증한 HEAD와 결과를 기록합니다. 실패가 있으면 종료 코드는 1입니다. | |
| 10 | 추가: `local`은 실행기 자체 검사 후 교차 도구를 찾습니다. 도구가 없으면 `setup_windows.sh`를 실행해 프로젝트 안에 최초 준비하므로 네트워크와 아래 준비 도구가 필요합니다. 준비 실패는 결과 JSON에 `tool-setup` 실패로 남깁니다. 준비된 도구가 있으면 다시 다운로드하지 않습니다. 이후 Linux 전체 빌드, Linux Rust 시험, Windows 교차 빌드를 순서대로 수행합니다. 단계별 통과/실패/비해당 개수를 출력하고 `tests/work/<작업명>/local-results.json`에 검증한 HEAD와 결과를 기록합니다. 실패가 있으면 종료 코드는 1입니다. | |
| 12 | 11 | |
| 13 | 12 | - Rust 1.99.1, 기존 Cargo.lock, `--locked --all-targets --all-features`를 사용합니다. `experiments/*/Cargo.toml`과 `tests/*/Cargo.toml`을 자동 발견합니다. |
| 14 | 13 | - Windows는 `x86_64-pc-windows-gnu` 대상의 링크까지 확인합니다. 시험 바이너리도 컴파일하지만 실행하지 않습니다. Windows MSVC 빌드 및 실제 실행 검증을 대신하지 않습니다. |
| 15 | 삭제: - 빌드 기본 병렬 수는 2이며 `CARGO_BUILD_JOBS`로 조절합니다. 시험 스레드는 1개입니다. `CARGO_TARGET_DIR` 기본값은 `tests/ci/target`이므로 후속 실행에서 빌드 캐시를 재사용합니다. | |
| 16 | 삭제: - `setup_windows.sh`는 관리자 권한 없이 도구를 `tests/ci/tools`에 풉니다. apt-get, dpkg-deb, rustup 및 GCC 호스트 실행 라이브러리가 필요합니다. 공용 도구 경로를 재사용할 때는 프로젝트 안의 소유 경로를 `ZIPELO_CI_TOOLS`로 지정합니다. 연결된 Git worktree에서는 현재 checkout의 도구를 먼저 찾고 같은 저장소 기본 worktree의 `tests/ci/tools`도 찾습니다. `ZIPELO_CI_TOOLS`를 지정하면 그 경로만 사용하며 별도 PATH 내보내기는 필요하지 않습니다. 기존 Rust target과 MinGW가 있으면 준비 스크립트 없이 PATH와 관련 Cargo/CC/CXX 환경 설정을 사용할 수 있습니다. | |
| 14 | 추가: - 빌드 기본 병렬 수는 2이며 `CARGO_BUILD_JOBS`로 조절합니다. 시험 스레드는 1개입니다. Cargo target과 임시 파일은 `tests/work/<작업명>/target`, `tmp`에 둡니다. `--job` 대신 `ZIPELO_CI_JOB`을 설정할 수 있습니다. | |
| 15 | 추가: - `setup_windows.sh`는 관리자 권한 없이 도구를 `tests/work/<작업명>/tools`에 풉니다. apt-get, dpkg-deb, rustup 및 GCC 호스트 실행 라이브러리가 필요합니다. 기존 도구 경로를 읽기 전용으로 재사용할 때는 `ZIPELO_CI_TOOLS`를 지정합니다. 설치가 필요하면 작업 폴더 안의 `tools`에 준비합니다. 과거 `tests/ci/tools`에 준비한 도구도 읽기 전용으로 재사용합니다. 기존 Rust target과 MinGW가 있으면 준비 스크립트 없이 PATH와 관련 Cargo/CC/CXX 환경 설정을 사용할 수 있습니다. | |
| 17 | 16 | - Linux GUI 빌드에는 pkg-config, libxkbcommon-dev, libwayland-dev, libgl1-mesa-dev가 필요하며 글꼴 시험에는 fonts-noto-cjk가 필요합니다. |
| 18 | 17 | - 추적된 fixture를 Git blob과 대조합니다. Windows checkout 시 core.autocrlf=false를 사용해야 하며 기대값의 바이트를 바꾸지 않습니다. |
| 19 | 삭제: - Unix 소켓 시험은 Cargo가 설정한 시험 crate의 현재 디렉터리에서 짧은 상대 경로로 소켓을 생성합니다. 소켓 파일은 기존 `runs` 안에 유지하며 긴 checkout 절대 경로에서도 실행됩니다. 별도 경로 매핑이나 `/tmp` 사용은 필요하지 않습니다. 기존 `runs` 디렉터리는 소유권, 0700, 빈 상태를 확인하고 새 디렉터리만 생성합니다. 실패한 fixture는 삭제하거나 권한을 바꾸지 않습니다. | |
| 18 | 추가: - Unix 소켓 시험은 Cargo가 설정한 시험 crate의 현재 디렉터리에서 짧은 상대 경로로 소켓을 생성합니다. 시험 파일은 `tests/work/<작업명>/fixtures` 안에 생성합니다. 파일 게시 시험은 소켓 주소에 디렉터리 핸들을 사용해 긴 checkout 절대 경로에서도 실행됩니다. fixture 디렉터리는 소유권, 0700, 빈 상태를 확인합니다. 실패한 fixture는 삭제하거나 권한을 바꾸지 않습니다. | |
| 20 | 19 | - 파일 게시 계층은 ext4/XFS만 지원합니다. tmpfs 등 다른 파일시스템에서는 `rust-file-publication`과 `rust-gzip-file-job`의 Rust 실행 시험만 `not-applicable`로 기록하고 파일시스템 식별값과 사유를 출력합니다. 해당 crate의 Linux 및 Windows 빌드와 snapshot 등 나머지 시험은 계속합니다. 전체 시험 통과가 필요한 검증은 ext4/XFS checkout에서 수행합니다. 파일시스템 탐색 오류나 기존 시험 디렉터리의 소유권 문제는 실패로 남깁니다. |
| 21 | 20 | - 개별 단계는 `build`, `test`, `cross-build`로 실행할 수 있습니다. 한 crate가 실패해도 다른 crate 결과를 수집합니다. |
| 22 | 21 | - GUI 앱과 GUI race harness는 컴파일하며 실제 화면 시나리오는 실행하지 않습니다. C# 시험과 역사적 hash 검사는 포함하지 않습니다. |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import argparse |
| 2 | 2 | import json |
| 3 | 3 | import os |
| 4 | 추가: import re | |
| 4 | 5 | from pathlib import Path |
| 5 | 6 | import shutil |
| 6 | 7 | import stat |
| @@ -19,6 +20,51 @@ LINUX_ONLY = { | ||
| 19 | 20 | } |
| 20 | 21 | FILE_FIXTURES = LINUX_ONLY - {"rust-ui-system-font-regressions"} |
| 21 | 22 | PUBLICATION_FIXTURES = {"rust-file-publication", "rust-gzip-file-job"} |
| 23 | 추가: JOB_NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]{0,63}\Z") | |
| 24 | 추가: | |
| 25 | 추가: | |
| 26 | 추가: def work_directory(root, name): | |
| 27 | 추가: if not JOB_NAME.fullmatch(name): | |
| 28 | 추가: raise ValueError("작업명은 영숫자로 시작하는 영숫자, 밑줄, 하이픈만 허용함") | |
| 29 | 추가: common = Path(subprocess.check_output( | |
| 30 | 추가: ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], | |
| 31 | 추가: cwd=root, text=True, | |
| 32 | 추가: ).strip()).resolve() | |
| 33 | 추가: project = common.parent if common.name == ".git" else root.resolve() | |
| 34 | 추가: tests = project / "tests" | |
| 35 | 추가: base = tests / "work" | |
| 36 | 추가: if tests.is_symlink() or not tests.is_dir(): | |
| 37 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {tests}") | |
| 38 | 추가: if base.is_symlink() or (base.exists() and not base.is_dir()): | |
| 39 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {base}") | |
| 40 | 추가: base.mkdir(mode=0o700, exist_ok=True) | |
| 41 | 추가: if base.resolve() != base: | |
| 42 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {base}") | |
| 43 | 추가: path = base / name | |
| 44 | 추가: if path.is_symlink() or (path.exists() and not path.is_dir()): | |
| 45 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {path}") | |
| 46 | 추가: path.mkdir(mode=0o700, exist_ok=True) | |
| 47 | 추가: if path.resolve() != path: | |
| 48 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {path}") | |
| 49 | 추가: return path | |
| 50 | 추가: | |
| 51 | 추가: | |
| 52 | 추가: def output_directory(work, name, create=False): | |
| 53 | 추가: path = work / name | |
| 54 | 추가: if not path.resolve().is_relative_to(work) or (path.exists() and not path.is_dir()): | |
| 55 | 추가: raise ValueError(f"작업 폴더 밖의 출력 경로는 허용하지 않음: {path}") | |
| 56 | 추가: if create: | |
| 57 | 추가: path.mkdir(mode=0o700, exist_ok=True) | |
| 58 | 추가: return path | |
| 59 | 추가: | |
| 60 | 추가: | |
| 61 | 추가: def test_work_directory(root): | |
| 62 | 추가: configured = os.environ.get("ZIPELO_TEST_WORK_DIR") | |
| 63 | 추가: if configured: | |
| 64 | 추가: return Path(configured) | |
| 65 | 추가: return work_directory(root, os.environ.get("ZIPELO_CI_JOB", "rust-local")) | |
| 66 | 추가: | |
| 67 | 추가: | |
| 22 | 68 | |
| 23 | 69 | |
| 24 | 70 | def manifests(root): |
| @@ -53,9 +99,9 @@ def command(manifest, phase): | ||
| 53 | 99 | def prepare_fixtures(root): |
| 54 | 100 | skipped = {} |
| 55 | 101 | for name in sorted(FILE_FIXTURES): |
| 56 | 삭제: path = root / "tests" / name / "runs" | |
| 102 | 추가: path = test_work_directory(root) / "fixtures" / name | |
| 57 | 103 | if not path.exists() and not path.is_symlink(): |
| 58 | 삭제: path.mkdir(mode=0o700) | |
| 104 | 추가: path.mkdir(mode=0o700, parents=True) | |
| 59 | 105 | info = path.lstat() |
| 60 | 106 | if ( |
| 61 | 107 | not stat.S_ISDIR(info.st_mode) |
| @@ -124,13 +170,13 @@ def prepare_tools(root): | ||
| 124 | 170 | if configured: |
| 125 | 171 | directories = [Path(configured).resolve()] |
| 126 | 172 | else: |
| 127 | 삭제: directories = [root / "tests/ci/tools"] | |
| 173 | 추가: directories = [test_work_directory(root) / "tools"] | |
| 128 | 174 | common = Path(subprocess.check_output( |
| 129 | 175 | ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], |
| 130 | 176 | cwd=root, text=True, |
| 131 | 177 | ).strip()) |
| 132 | 삭제: # 같은 저장소의 기본 worktree에 준비한 도구만 재사용함. | |
| 133 | 삭제: if common.name == ".git" and common.parent != root: | |
| 178 | 추가: # 같은 저장소의 기본 worktree에 준비한 도구를 재사용함. | |
| 179 | 추가: if common.name == ".git": | |
| 134 | 180 | directories.append(common.parent / "tests/ci/tools") |
| 135 | 181 | for tools in directories: |
| 136 | 182 | if (tools / "rustup/toolchains/1.99.1-x86_64-unknown-linux-gnu").is_dir(): |
| @@ -169,7 +215,10 @@ def prepare_local_tools(root): | ||
| 169 | 215 | prepare_cross_build() |
| 170 | 216 | except ValueError: |
| 171 | 217 | print("Windows 교차 도구를 프로젝트 내부에 준비함: tests/ci/setup_windows.sh", flush=True) |
| 172 | 삭제: subprocess.run(["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, check=True) | |
| 218 | 추가: environment = dict(os.environ, ZIPELO_CI_TOOLS=str(test_work_directory(root) / "tools")) | |
| 219 | 추가: subprocess.run(["bash", str(root / "tests/ci/setup_windows.sh")], | |
| 220 | 추가: cwd=root, env=environment, check=True) | |
| 221 | 추가: os.environ["ZIPELO_CI_TOOLS"] = environment["ZIPELO_CI_TOOLS"] | |
| 173 | 222 | prepare_tools(root) |
| 174 | 223 | prepare_cross_build() |
| 175 | 224 | |
| @@ -191,12 +240,22 @@ def execute_phases(root, phases): | ||
| 191 | 240 | def main(): |
| 192 | 241 | parser = argparse.ArgumentParser(description="로컬 Linux 시험과 Windows 교차 빌드") |
| 193 | 242 | parser.add_argument("phase", choices=["local", "build", "test", "cross-build"]) |
| 243 | 추가: parser.add_argument("--job", default=os.environ.get("ZIPELO_CI_JOB", "rust-local")) | |
| 194 | 244 | args = parser.parse_args() |
| 195 | 245 | if args.phase == "local" and sys.platform != "linux": |
| 196 | 246 | parser.error("local 모드는 Linux에서 실행해야 함") |
| 197 | 삭제: prepare_tools(ROOT) | |
| 247 | 추가: work = work_directory(ROOT, args.job) | |
| 248 | 추가: temporary = output_directory(work, "tmp", create=True) | |
| 249 | 추가: target = output_directory(work, "target") | |
| 250 | 추가: os.environ["ZIPELO_CI_JOB"] = args.job | |
| 251 | 추가: os.environ["ZIPELO_TEST_WORK_DIR"] = str(work) | |
| 252 | 추가: os.environ["TMPDIR"] = str(temporary) | |
| 253 | 추가: os.environ["TMP"] = str(temporary) | |
| 254 | 추가: os.environ["TEMP"] = str(temporary) | |
| 255 | 추가: os.environ["PYTHONDONTWRITEBYTECODE"] = "1" | |
| 198 | 256 | os.environ.setdefault("CARGO_BUILD_JOBS", "2") |
| 199 | 삭제: os.environ.setdefault("CARGO_TARGET_DIR", str(ROOT / "tests/ci/target")) | |
| 257 | 추가: os.environ["CARGO_TARGET_DIR"] = str(target) | |
| 258 | 추가: prepare_tools(ROOT) | |
| 200 | 259 | phases = ["build", "test", "cross-build"] if args.phase == "local" else [args.phase] |
| 201 | 260 | checks = subprocess.run( |
| 202 | 261 | [sys.executable, "-m", "unittest", "discover", "-s", "tests/ci", "-p", "test_*.py"], |
| @@ -227,7 +286,7 @@ def main(): | ||
| 227 | 286 | "windows_runtime_tested": checks.returncode == 0 and sys.platform == "win32" and "test" in phases, |
| 228 | 287 | "results": results, |
| 229 | 288 | } |
| 230 | 삭제: (ROOT / f"tests/ci/{args.phase}-results.json").write_text( | |
| 289 | 추가: (work / f"{args.phase}-results.json").write_text( | |
| 231 | 290 | json.dumps(report, ensure_ascii=False, indent=4) + "\n", encoding="utf-8" |
| 232 | 291 | ) |
| 233 | 292 | lines = [] |
| @@ -2,7 +2,14 @@ | ||
| 2 | 2 | set -euo pipefail |
| 3 | 3 | |
| 4 | 4 | repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 5 | 삭제: ci_tools="${ZIPELO_CI_TOOLS:-$repo_root/tests/ci/tools}" | |
| 5 | 추가: common_dir="$(git -C "$repo_root" rev-parse --path-format=absolute --git-common-dir)" | |
| 6 | 추가: project_root="$(dirname "$common_dir")" | |
| 7 | 추가: job="${ZIPELO_CI_JOB:-rust-local}" | |
| 8 | 추가: if [[ ! "$job" =~ ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$ ]]; then | |
| 9 | 추가: echo "유효하지 않은 작업명: $job" >&2 | |
| 10 | 추가: exit 2 | |
| 11 | 추가: fi | |
| 12 | 추가: ci_tools="${ZIPELO_CI_TOOLS:-$project_root/tests/work/$job/tools}" | |
| 6 | 13 | mkdir -p "$ci_tools/downloads" "$ci_tools/mingw" |
| 7 | 14 | ci_tools="$(cd "$ci_tools" && pwd)" |
| 8 | 15 |
| @@ -7,13 +7,15 @@ import subprocess | ||
| 7 | 7 | import tempfile |
| 8 | 8 | import unittest |
| 9 | 9 | |
| 10 | 추가: import run_rust | |
| 11 | 추가: | |
| 10 | 12 | ROOT = Path(__file__).resolve().parents[2] |
| 11 | 13 | HELPER = ROOT / "packaging/ubuntu/rust/default-apps" |
| 12 | 14 | |
| 13 | 15 | |
| 14 | 16 | class DefaultAppsTests(unittest.TestCase): |
| 15 | 17 | def setUp(self): |
| 16 | 삭제: work = ROOT / "tests/work" | |
| 18 | 추가: work = run_rust.test_work_directory(ROOT) | |
| 17 | 19 | work.mkdir(exist_ok=True) |
| 18 | 20 | self.temporary = tempfile.TemporaryDirectory(dir=work) |
| 19 | 21 | self.addCleanup(self.temporary.cleanup) |
| @@ -5,14 +5,16 @@ import subprocess | ||
| 5 | 5 | import tempfile |
| 6 | 6 | import unittest |
| 7 | 7 | |
| 8 | 추가: import run_rust | |
| 9 | 추가: | |
| 8 | 10 | ROOT = Path(__file__).resolve().parents[2] |
| 9 | 11 | |
| 10 | 12 | |
| 11 | 13 | class IconBuildTests(unittest.TestCase): |
| 12 | 14 | @classmethod |
| 13 | 15 | def setUpClass(cls): |
| 14 | 삭제: (ROOT / "tests/work").mkdir(parents=True, exist_ok=True) | |
| 15 | 삭제: cls.scratch = tempfile.TemporaryDirectory(dir=ROOT / "tests/work") | |
| 16 | 추가: work = run_rust.test_work_directory(ROOT) | |
| 17 | 추가: cls.scratch = tempfile.TemporaryDirectory(dir=work) | |
| 16 | 18 | cls.addClassCleanup(cls.scratch.cleanup) |
| 17 | 19 | cls.root = Path(cls.scratch.name) |
| 18 | 20 | cls.builder = cls.root / "build.exe" |
| @@ -1,13 +1,19 @@ | ||
| 1 | 1 | import gzip |
| 2 | 2 | import importlib.util |
| 3 | 3 | import io |
| 4 | 추가: import os | |
| 5 | 추가: import subprocess | |
| 6 | 추가: import sys | |
| 4 | 7 | from pathlib import Path |
| 5 | 8 | import tarfile |
| 6 | 9 | import tempfile |
| 7 | 10 | import unittest |
| 11 | 추가: from unittest.mock import patch | |
| 8 | 12 | import zipfile |
| 9 | 13 | |
| 10 | 14 | |
| 15 | 추가: import run_rust | |
| 16 | 추가: | |
| 11 | 17 | ROOT = Path(__file__).resolve().parents[2] |
| 12 | 18 | SPEC = importlib.util.spec_from_file_location( |
| 13 | 19 | "large_fixture_generator", ROOT / "tests/large-archive-fixtures/generate.py" |
| @@ -17,8 +23,34 @@ SPEC.loader.exec_module(GENERATOR) | ||
| 17 | 23 | |
| 18 | 24 | |
| 19 | 25 | class LargeArchiveFixtureTests(unittest.TestCase): |
| 26 | 추가: def test_standalone_generator_uses_common_work_directory(self): | |
| 27 | 추가: expected = run_rust.test_work_directory(ROOT) | |
| 28 | 추가: with tempfile.TemporaryDirectory(dir=expected) as scratch: | |
| 29 | 추가: relative = Path(scratch).name + "/corpus" | |
| 30 | 추가: environment = dict(os.environ, ZIPELO_CI_JOB=expected.name) | |
| 31 | 추가: environment.pop("ZIPELO_TEST_WORK_DIR", None) | |
| 32 | 추가: result = subprocess.run( | |
| 33 | 추가: ["python3", str(ROOT / "tests/large-archive-fixtures/generate.py"), | |
| 34 | 추가: "--output", relative], | |
| 35 | 추가: cwd=ROOT, env=environment, capture_output=True, text=True, check=True, | |
| 36 | 추가: ) | |
| 37 | 추가: self.assertTrue((Path(scratch) / "corpus/expectations.json").is_file()) | |
| 38 | 추가: self.assertIn("11 cases", result.stdout) | |
| 39 | 추가: | |
| 40 | 추가: def test_standalone_verifier_uses_work_target(self): | |
| 41 | 추가: job = run_rust.test_work_directory(ROOT).name | |
| 42 | 추가: with patch.dict(os.environ, {"ZIPELO_CI_JOB": job}), patch.dict(sys.modules, {"generate": GENERATOR}): | |
| 43 | 추가: os.environ.pop("ZIPELO_TEST_WORK_DIR", None) | |
| 44 | 추가: os.environ.pop("CARGO_TARGET_DIR", None) | |
| 45 | 추가: spec = importlib.util.spec_from_file_location( | |
| 46 | 추가: "large_fixture_verifier", ROOT / "tests/large-archive-fixtures/verify.py" | |
| 47 | 추가: ) | |
| 48 | 추가: verifier = importlib.util.module_from_spec(spec) | |
| 49 | 추가: spec.loader.exec_module(verifier) | |
| 50 | 추가: self.assertEqual(verifier.default_target(), GENERATOR.work_root() / "target/debug") | |
| 51 | 추가: | |
| 20 | 52 | def test_boundary_archives_are_valid_and_expectations_straddle_limit(self): |
| 21 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 53 | 추가: with tempfile.TemporaryDirectory(dir=run_rust.test_work_directory(ROOT)) as scratch: | |
| 22 | 54 | directory = Path(scratch) / "corpus" |
| 23 | 55 | manifest = GENERATOR.build(directory) |
| 24 | 56 | self.assertEqual(len(manifest["cases"]), 11) |
| @@ -52,7 +84,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 52 | 84 | self.assertEqual(case["expected"]["created_count"], 0 if failed else 1) |
| 53 | 85 | |
| 54 | 86 | def test_former_ratio_samples_all_expect_success(self): |
| 55 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 87 | 추가: with tempfile.TemporaryDirectory(dir=run_rust.test_work_directory(ROOT)) as scratch: | |
| 56 | 88 | manifest = GENERATOR.build(Path(scratch) / "corpus") |
| 57 | 89 | for suffix, delta in (("below", -1), ("equal", 0), ("above", 1)): |
| 58 | 90 | name = "ratio-" + suffix + ".gz" |
| @@ -66,7 +98,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 66 | 98 | self.assertEqual(payload, bytes(artifact["payload_bytes"])) |
| 67 | 99 | |
| 68 | 100 | def test_generator_rejects_existing_destination_without_changes(self): |
| 69 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 101 | 추가: with tempfile.TemporaryDirectory(dir=run_rust.test_work_directory(ROOT)) as scratch: | |
| 70 | 102 | directory = Path(scratch) |
| 71 | 103 | marker = directory / "keep" |
| 72 | 104 | marker.write_bytes(b"preserve") |
| @@ -77,7 +109,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 77 | 109 | |
| 78 | 110 | def test_generator_requires_project_test_directory(self): |
| 79 | 111 | with self.assertRaises(ValueError): |
| 80 | 삭제: GENERATOR.build(ROOT / "outside-tests") | |
| 112 | 추가: GENERATOR.build(run_rust.test_work_directory(ROOT).parent / "outside-tests") | |
| 81 | 113 | |
| 82 | 114 | def test_payload_source_enforces_bounded_reads(self): |
| 83 | 115 | source = GENERATOR.ZeroStream(GENERATOR.GIB) |
| @@ -0,0 +1,42 @@ | ||
| 1 | 추가: import importlib.util | |
| 2 | 추가: import os | |
| 3 | 추가: import subprocess | |
| 4 | 추가: from pathlib import Path | |
| 5 | 추가: import unittest | |
| 6 | 추가: from unittest.mock import patch | |
| 7 | 추가: | |
| 8 | 추가: ROOT = Path(__file__).resolve().parents[2] | |
| 9 | 추가: SPEC = importlib.util.spec_from_file_location( | |
| 10 | 추가: "native_smoke", ROOT / "tests/rust-app-ui/native_smoke.py" | |
| 11 | 추가: ) | |
| 12 | 추가: SMOKE = importlib.util.module_from_spec(SPEC) | |
| 13 | 추가: SPEC.loader.exec_module(SMOKE) | |
| 14 | 추가: | |
| 15 | 추가: | |
| 16 | 추가: class NativeSmokePathsTests(unittest.TestCase): | |
| 17 | 추가: def test_default_binary_uses_common_work_target(self): | |
| 18 | 추가: common = Path(subprocess.check_output( | |
| 19 | 추가: ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], | |
| 20 | 추가: cwd=ROOT, text=True, | |
| 21 | 추가: ).strip()).resolve() | |
| 22 | 추가: expected = common.parent / "tests/work/rust-local" | |
| 23 | 추가: with patch.dict(os.environ): | |
| 24 | 추가: os.environ.pop("ZIPELO_CI_JOB", None) | |
| 25 | 추가: os.environ.pop("CARGO_TARGET_DIR", None) | |
| 26 | 추가: work = SMOKE.work_directory() | |
| 27 | 추가: self.assertEqual(work, expected) | |
| 28 | 추가: self.assertEqual(SMOKE.binary_path(work), | |
| 29 | 추가: work / "target/debug/zipelo-ui-memory-app") | |
| 30 | 추가: | |
| 31 | 추가: def test_job_and_target_overrides_are_honored(self): | |
| 32 | 추가: work = SMOKE.work_directory().parent / "native-smoke-paths" | |
| 33 | 추가: target = work / "custom-target" | |
| 34 | 추가: with patch.dict(os.environ, {"ZIPELO_CI_JOB": "native-smoke-paths", | |
| 35 | 추가: "CARGO_TARGET_DIR": str(target)}): | |
| 36 | 추가: self.assertEqual(SMOKE.work_directory(), work) | |
| 37 | 추가: self.assertEqual(SMOKE.binary_path(work), | |
| 38 | 추가: target / "debug/zipelo-ui-memory-app") | |
| 39 | 추가: | |
| 40 | 추가: | |
| 41 | 추가: if __name__ == "__main__": | |
| 42 | 추가: unittest.main() |
| @@ -1,17 +1,81 @@ | ||
| 1 | 1 | from contextlib import redirect_stdout |
| 2 | 2 | from io import StringIO |
| 3 | 3 | import json |
| 4 | 추가: import os | |
| 4 | 5 | from pathlib import Path, PurePosixPath, PureWindowsPath |
| 5 | 6 | import tempfile |
| 6 | 7 | import subprocess |
| 7 | 8 | import sys |
| 8 | 9 | import unittest |
| 9 | 삭제: from unittest.mock import patch | |
| 10 | 추가: from unittest.mock import ANY, patch | |
| 10 | 11 | |
| 11 | 12 | import run_rust |
| 12 | 13 | |
| 13 | 14 | |
| 15 | 추가: TEST_WORK = run_rust.work_directory( | |
| 16 | 추가: run_rust.ROOT, os.environ.get("ZIPELO_CI_JOB", "rust-local") | |
| 17 | 추가: ) | |
| 18 | 추가: | |
| 19 | 추가: | |
| 14 | 20 | class RunnerTests(unittest.TestCase): |
| 21 | 추가: def test_job_directory_is_restricted_to_one_work_child(self): | |
| 22 | 추가: for name in ("../escape", "other/job", "", ".hidden", "bad name"): | |
| 23 | 추가: with self.subTest(name=name), self.assertRaises(ValueError): | |
| 24 | 추가: run_rust.work_directory(run_rust.ROOT, name) | |
| 25 | 추가: self.assertEqual(run_rust.work_directory( | |
| 26 | 추가: run_rust.ROOT, os.environ.get("ZIPELO_CI_JOB", "rust-local") | |
| 27 | 추가: ), TEST_WORK) | |
| 28 | 추가: | |
| 29 | 추가: def test_work_directory_rejects_symlinked_parents_before_creation(self): | |
| 30 | 추가: for link_name in ("tests", "tests/work"): | |
| 31 | 추가: with self.subTest(link_name=link_name), tempfile.TemporaryDirectory( | |
| 32 | 추가: dir=TEST_WORK | |
| 33 | 추가: ) as directory: | |
| 34 | 추가: base = Path(directory) | |
| 35 | 추가: project = base / "project" | |
| 36 | 추가: project.mkdir() | |
| 37 | 추가: outside = base / "outside" | |
| 38 | 추가: outside.mkdir() | |
| 39 | 추가: link = project / link_name | |
| 40 | 추가: link.parent.mkdir(parents=True, exist_ok=True) | |
| 41 | 추가: link.symlink_to(outside, target_is_directory=True) | |
| 42 | 추가: with patch.object( | |
| 43 | 추가: run_rust.subprocess, "check_output", return_value=str(project / ".git") | |
| 44 | 추가: ): | |
| 45 | 추가: with self.assertRaisesRegex(ValueError, "안전한 작업 디렉터리"): | |
| 46 | 추가: run_rust.work_directory(project, "task") | |
| 47 | 추가: self.assertFalse((outside / "task").exists()) | |
| 48 | 추가: self.assertFalse((outside / "work").exists()) | |
| 49 | 추가: | |
| 50 | 추가: def test_output_paths_reject_symlinks_outside_job(self): | |
| 51 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 52 | 추가: work = Path(directory) | |
| 53 | 추가: outside = TEST_WORK / "outside" | |
| 54 | 추가: for name in ("tmp", "target"): | |
| 55 | 추가: with self.subTest(name=name): | |
| 56 | 추가: link = work / name | |
| 57 | 추가: link.symlink_to(outside, target_is_directory=True) | |
| 58 | 추가: with self.assertRaisesRegex(ValueError, "작업 폴더 밖"): | |
| 59 | 추가: run_rust.output_directory(work, name, create=True) | |
| 60 | 추가: self.assertFalse(outside.exists()) | |
| 61 | 추가: link.unlink() | |
| 62 | 추가: | |
| 63 | 추가: def test_output_paths_allow_symlinks_within_job(self): | |
| 64 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 65 | 추가: work = Path(directory) | |
| 66 | 추가: inner = work / "inner" | |
| 67 | 추가: inner.mkdir() | |
| 68 | 추가: link = work / "tmp" | |
| 69 | 추가: link.symlink_to(inner, target_is_directory=True) | |
| 70 | 추가: self.assertEqual(run_rust.output_directory(work, "tmp", create=True), link) | |
| 71 | 추가: | |
| 72 | 추가: def test_cargo_and_temp_paths_are_kept_in_job_directory(self): | |
| 73 | 추가: if "ZIPELO_TEST_WORK_DIR" not in os.environ: | |
| 74 | 추가: self.skipTest("러너가 설정한 작업 경로에서 검사함") | |
| 75 | 추가: for key in ("CARGO_TARGET_DIR", "TMPDIR", "TMP", "TEMP", "ZIPELO_TEST_WORK_DIR"): | |
| 76 | 추가: with self.subTest(key=key): | |
| 77 | 추가: self.assertTrue(Path(os.environ[key]).resolve().is_relative_to(TEST_WORK)) | |
| 78 | 추가: | |
| 15 | 79 | def test_all_manifests_have_locks(self): |
| 16 | 80 | paths = run_rust.manifests(run_rust.ROOT) |
| 17 | 81 | expected = set(run_rust.ROOT.glob("experiments/*/Cargo.toml")) |
| @@ -84,13 +148,14 @@ class RunnerTests(unittest.TestCase): | ||
| 84 | 148 | def test_self_check_failure_replaces_previous_success_report(self): |
| 85 | 149 | for phase, platform in (("local", "linux"), ("test", "win32")): |
| 86 | 150 | with self.subTest(phase=phase), tempfile.TemporaryDirectory( |
| 87 | 삭제: dir=run_rust.ROOT / "tests/ci" | |
| 151 | 추가: dir=TEST_WORK | |
| 88 | 152 | ) as directory: |
| 89 | 153 | root = Path(directory) |
| 90 | 삭제: (root / "tests/ci").mkdir(parents=True) | |
| 91 | 삭제: report_path = root / f"tests/ci/{phase}-results.json" | |
| 154 | 추가: (root / "work/tmp").mkdir(parents=True) | |
| 155 | 추가: report_path = root / f"work/{phase}-results.json" | |
| 92 | 156 | with ( |
| 93 | 157 | patch.object(run_rust, "ROOT", root), |
| 158 | 추가: patch.object(run_rust, "work_directory", return_value=root / "work"), | |
| 94 | 159 | patch.object(run_rust, "prepare_tools"), |
| 95 | 160 | patch.object(run_rust, "prepare_local_tools"), |
| 96 | 161 | patch.object(run_rust.sys, "argv", ["run_rust.py", phase]), |
| @@ -125,7 +190,7 @@ class RunnerTests(unittest.TestCase): | ||
| 125 | 190 | |
| 126 | 191 | @unittest.skipUnless(sys.platform == "linux", "Linux MinGW 실행 파일 탐색 시험임") |
| 127 | 192 | def test_linked_worktree_finds_setup_tools_without_path_export(self): |
| 128 | 삭제: with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: | |
| 193 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 129 | 194 | base = Path(directory) |
| 130 | 195 | root = base / "linked" |
| 131 | 196 | tools = base / "tests/ci/tools" |
| @@ -149,6 +214,37 @@ class RunnerTests(unittest.TestCase): | ||
| 149 | 214 | str(binaries / "x86_64-w64-mingw32-gcc-posix"), |
| 150 | 215 | ) |
| 151 | 216 | |
| 217 | 추가: @unittest.skipUnless(sys.platform == "linux", "Linux MinGW 실행 파일 탐색 시험임") | |
| 218 | 추가: def test_default_checkout_reuses_existing_setup_tools(self): | |
| 219 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 220 | 추가: root = Path(directory) | |
| 221 | 추가: tools = root / "tests/ci/tools" | |
| 222 | 추가: binaries = tools / "mingw/usr/bin" | |
| 223 | 추가: binaries.mkdir(parents=True) | |
| 224 | 추가: executable = binaries / "x86_64-w64-mingw32-gcc-posix" | |
| 225 | 추가: executable.write_text("#!/bin/sh\nexit 0\n") | |
| 226 | 추가: executable.chmod(0o700) | |
| 227 | 추가: rustup = tools / "rustup" | |
| 228 | 추가: (rustup / "toolchains/1.99.1-x86_64-unknown-linux-gnu").mkdir(parents=True) | |
| 229 | 추가: with ( | |
| 230 | 추가: patch.dict(run_rust.os.environ, {"PATH": ""}, clear=True), | |
| 231 | 추가: patch.object(run_rust.subprocess, "check_output", return_value=str(root / ".git")), | |
| 232 | 추가: ): | |
| 233 | 추가: run_rust.prepare_tools(root) | |
| 234 | 추가: self.assertEqual(run_rust.os.environ["RUSTUP_HOME"], str(rustup)) | |
| 235 | 추가: self.assertTrue(run_rust.os.environ["PATH"].startswith(str(binaries))) | |
| 236 | 추가: self.assertEqual(run_rust.shutil.which("x86_64-w64-mingw32-gcc-posix"), | |
| 237 | 추가: str(executable)) | |
| 238 | 추가: | |
| 239 | 추가: def test_unconfigured_work_directory_uses_common_project(self): | |
| 240 | 추가: with patch.dict(os.environ), patch.object( | |
| 241 | 추가: run_rust, "work_directory", return_value=TEST_WORK | |
| 242 | 추가: ) as directory: | |
| 243 | 추가: os.environ.pop("ZIPELO_TEST_WORK_DIR", None) | |
| 244 | 추가: os.environ.pop("ZIPELO_CI_JOB", None) | |
| 245 | 추가: self.assertEqual(run_rust.test_work_directory(run_rust.ROOT), TEST_WORK) | |
| 246 | 추가: directory.assert_called_once_with(run_rust.ROOT, "rust-local") | |
| 247 | 추가: | |
| 152 | 248 | def test_local_bootstraps_missing_cross_tools_and_reloads_paths(self): |
| 153 | 249 | for root in (Path("/repo"), PurePosixPath("/repo"), PureWindowsPath("C:/repo")): |
| 154 | 250 | with self.subTest(root=root): |
| @@ -156,10 +252,11 @@ class RunnerTests(unittest.TestCase): | ||
| 156 | 252 | patch.object(run_rust, "prepare_cross_build", side_effect=[ValueError("missing"), None]) as detect, |
| 157 | 253 | patch.object(run_rust.subprocess, "run") as setup, |
| 158 | 254 | patch.object(run_rust, "prepare_tools") as reload, |
| 255 | 추가: patch.object(run_rust, "test_work_directory", return_value=root / "tests/work/rust-local"), | |
| 159 | 256 | ): |
| 160 | 257 | run_rust.prepare_local_tools(root) |
| 161 | 258 | setup.assert_called_once_with( |
| 162 | 삭제: ["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, check=True, | |
| 259 | 추가: ["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, env=ANY, check=True, | |
| 163 | 260 | ) |
| 164 | 261 | reload.assert_called_once_with(root) |
| 165 | 262 | self.assertEqual(detect.call_count, 2) |
| @@ -184,10 +281,10 @@ class RunnerTests(unittest.TestCase): | ||
| 184 | 281 | |
| 185 | 282 | @unittest.skipUnless(sys.platform == "linux", "Linux 파일시스템과 소유권 검사 시험임") |
| 186 | 283 | def test_filesystem_skip_is_limited_to_publication_test_crates(self): |
| 187 | 삭제: with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: | |
| 284 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 188 | 285 | root = Path(directory) |
| 189 | 삭제: for name in run_rust.FILE_FIXTURES: | |
| 190 | 삭제: (root / "tests" / name).mkdir(parents=True) | |
| 286 | 추가: work = root / "work" | |
| 287 | 추가: work.mkdir() | |
| 191 | 288 | paths = [ |
| 192 | 289 | root / "tests/rust-file-publication/Cargo.toml", |
| 193 | 290 | root / "tests/rust-gzip-file-job/Cargo.toml", |
| @@ -196,6 +293,7 @@ class RunnerTests(unittest.TestCase): | ||
| 196 | 293 | ] |
| 197 | 294 | with ( |
| 198 | 295 | patch.object(run_rust, "manifests", return_value=paths), |
| 296 | 추가: patch.dict(run_rust.os.environ, {"ZIPELO_TEST_WORK_DIR": str(work)}), | |
| 199 | 297 | patch.object(run_rust.subprocess, "check_output", return_value="1021994\n"), |
| 200 | 298 | patch.object(run_rust.subprocess, "run", return_value=subprocess.CompletedProcess([], 0)) as cargo, |
| 201 | 299 | ): |
| @@ -212,18 +310,19 @@ class RunnerTests(unittest.TestCase): | ||
| 212 | 310 | |
| 213 | 311 | @unittest.skipUnless(sys.platform == "linux", "Linux 소켓 경로 회귀 시험임") |
| 214 | 312 | def test_long_checkout_does_not_block_file_fixtures(self): |
| 215 | 삭제: work = run_rust.ROOT / "tests/work" | |
| 216 | 삭제: work.mkdir(exist_ok=True) | |
| 217 | 삭제: with tempfile.TemporaryDirectory(dir=work) as directory: | |
| 313 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 218 | 314 | root = Path(directory) / ("long-checkout-" * 10) |
| 219 | 삭제: for name in run_rust.FILE_FIXTURES: | |
| 220 | 삭제: (root / "tests" / name).mkdir(parents=True) | |
| 315 | 추가: work = Path(directory) / "work" | |
| 221 | 316 | socket = root / "tests/rust-file-publication/runs/case-1-1/parent/output" |
| 222 | 317 | self.assertGreaterEqual(len(run_rust.os.fsencode(socket)), 108) |
| 223 | 삭제: with patch.object(run_rust.subprocess, "check_output", return_value="ef53\n"): | |
| 318 | 추가: with ( | |
| 319 | 추가: patch.dict(run_rust.os.environ, {"ZIPELO_TEST_WORK_DIR": str(work)}), | |
| 320 | 추가: patch.object(run_rust.subprocess, "check_output", return_value="ef53\n"), | |
| 321 | 추가: ): | |
| 224 | 322 | self.assertEqual(run_rust.prepare_fixtures(root), {}) |
| 225 | 323 | for name in run_rust.FILE_FIXTURES: |
| 226 | 삭제: self.assertEqual(list((root / "tests" / name / "runs").iterdir()), []) | |
| 324 | 추가: self.assertEqual(list((work / "fixtures" / name).iterdir()), []) | |
| 325 | 추가: self.assertFalse((root / "tests" / name / "runs").exists()) | |
| 227 | 326 | |
| 228 | 327 | def test_unknown_filesystem_probe_error_is_failure(self): |
| 229 | 328 | with ( |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import argparse |
| 2 | 2 | import importlib.util |
| 3 | 추가: import os | |
| 3 | 4 | from pathlib import Path |
| 4 | 5 | import struct |
| 5 | 6 | import re |
| @@ -10,6 +11,8 @@ import sys | ||
| 10 | 11 | from unittest.mock import patch |
| 11 | 12 | import unittest |
| 12 | 13 | |
| 14 | 추가: import run_rust | |
| 15 | 추가: | |
| 13 | 16 | ROOT = Path(__file__).resolve().parents[2] |
| 14 | 17 | SPEC = importlib.util.spec_from_file_location("windows_installer", ROOT / "packaging/windows/rust/build.py") |
| 15 | 18 | MODULE = importlib.util.module_from_spec(SPEC) |
| @@ -18,7 +21,7 @@ SPEC.loader.exec_module(MODULE) | ||
| 18 | 21 | |
| 19 | 22 | class InstallerInputTests(unittest.TestCase): |
| 20 | 23 | def setUp(self): |
| 21 | 삭제: runs = ROOT / "tests/windows-installer/runs" | |
| 24 | 추가: runs = run_rust.test_work_directory(ROOT) / "fixtures/windows-installer" | |
| 22 | 25 | runs.mkdir(parents=True, exist_ok=True) |
| 23 | 26 | self.directory = tempfile.TemporaryDirectory(dir=runs) |
| 24 | 27 | self.addCleanup(self.directory.cleanup) |
| @@ -14,20 +14,20 @@ Python 표준 라이브러리로 실행할 때 합성 표본을 생성합니다. | ||
| 14 | 14 | |
| 15 | 15 | ## 실행 |
| 16 | 16 | |
| 17 | 삭제: 저장소 루트에서 실행합니다. --large는 1 GiB 성공 2건과 16 GiB 초과 거부를 포함해 총 14건을 검사합니다. 생성을 포함한 기본 실행은 tests 안의 전용 임시 디렉터리를 쓰고 종료 시 정리합니다. 압축 표본, 입력 사본과 출력에 수 GiB의 임시 디스크 공간이 필요합니다. | |
| 17 | 추가: 저장소 루트에서 실행합니다. --large는 1 GiB 성공 2건과 16 GiB 초과 거부를 포함해 총 14건을 검사합니다. 생성을 포함한 기본 실행은 tests/work/rust-local 안의 전용 임시 디렉터리를 쓰고 종료 시 정리합니다. 압축 표본, 입력 사본과 출력에 수 GiB의 임시 디스크 공간이 필요합니다. | |
| 18 | 18 | |
| 19 | 19 | ```sh |
| 20 | 20 | python3 tests/ci/run_rust.py local |
| 21 | 21 | python3 tests/large-archive-fixtures/verify.py --large |
| 22 | 22 | ``` |
| 23 | 23 | |
| 24 | 삭제: CARGO_TARGET_DIR을 지정했다면 검증기도 같은 환경 값을 사용합니다. --probe와 --worker로 바이너리 경로를 따로 지정할 수도 있습니다. --large를 생략하면 작은 경계 및 고압축 호환성 11건만 검사합니다. 기본 local 실행에는 작은 표본의 참조 무결성, 경계 독립성과 생성기 경로 및 버퍼 제약 검사가 포함됩니다. | |
| 24 | 추가: 검증기는 기본적으로 tests/work/rust-local/target의 빌드를 사용합니다. CARGO_TARGET_DIR을 지정했다면 같은 환경 값을 사용합니다. --probe와 --worker로 바이너리 경로를 따로 지정할 수도 있습니다. --large를 생략하면 작은 경계 및 고압축 호환성 11건만 검사합니다. 기본 local 실행에는 작은 표본의 참조 무결성, 경계 독립성과 생성기 경로 및 버퍼 제약 검사가 포함됩니다. | |
| 25 | 25 | |
| 26 | 삭제: 표본을 보존하려면 아래처럼 새 경로를 지정합니다. 기존 디렉터리는 생성기가 덮어쓰지 않으며, 검증기는 기존 expectations.json이 있으면 재사용합니다. | |
| 26 | 추가: 표본을 보존하려면 아래처럼 작업 폴더 안의 새 상대 경로를 지정합니다. 기존 디렉터리는 생성기가 덮어쓰지 않으며, 검증기는 기존 expectations.json이 있으면 재사용합니다. | |
| 27 | 27 | |
| 28 | 28 | ```sh |
| 29 | 삭제: python3 tests/large-archive-fixtures/generate.py --large --output tests/large-archive-fixtures/runs/full | |
| 30 | 삭제: python3 tests/large-archive-fixtures/verify.py --large --directory tests/large-archive-fixtures/runs/full | |
| 29 | 추가: python3 tests/large-archive-fixtures/generate.py --large --output large-archive-fixtures/full | |
| 30 | 추가: python3 tests/large-archive-fixtures/verify.py --large --directory large-archive-fixtures/full | |
| 31 | 31 | ``` |
| 32 | 32 | |
| 33 | 33 | 검증기는 전체 표본을 참조 판독기로 읽어 합성 내용, CRC와 TAR 구조를 확인한 후 실제 작업자의 종료 코드, Terminal, 오류, 게시 상태, Output 개수와 정리를 확인합니다. 성공 파일은 길이와 모든 바이트를 검사하며 거부한 경우 출력 폴더가 비어 있어야 합니다. 입력의 전후 SHA-256도 확인합니다. 작업자 피크 RSS, 디스크 부족과 고아 작업자 정리는 tests/rust-archive-worker/hardening.rs에서 별도로 검사합니다. Windows 실기는 별도 검증이 필요합니다. |
| @@ -5,6 +5,9 @@ import gzip | ||
| 5 | 5 | import hashlib |
| 6 | 6 | import io |
| 7 | 7 | import json |
| 8 | 추가: import os | |
| 9 | 추가: import re | |
| 10 | 추가: import subprocess | |
| 8 | 11 | from pathlib import Path |
| 9 | 12 | import struct |
| 10 | 13 | import tarfile |
| @@ -18,6 +21,25 @@ CHUNK = 64 * 1024 | ||
| 18 | 21 | INPUT_LIMIT = 2 ** 64 - 1 |
| 19 | 22 | OUTPUT_LIMIT = 16 * GIB |
| 20 | 23 | NAME = "payload.bin" |
| 24 | 추가: JOB_NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]{0,63}\Z") | |
| 25 | 추가: | |
| 26 | 추가: | |
| 27 | 추가: def work_root(): | |
| 28 | 추가: job = os.environ.get("ZIPELO_CI_JOB", "rust-local") | |
| 29 | 추가: if not JOB_NAME.fullmatch(job): | |
| 30 | 추가: raise ValueError("안전한 작업명이 필요함") | |
| 31 | 추가: common = Path(subprocess.check_output( | |
| 32 | 추가: ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], | |
| 33 | 추가: cwd=ROOT, text=True, | |
| 34 | 추가: ).strip()).resolve() | |
| 35 | 추가: project = common.parent if common.name == ".git" else ROOT.resolve() | |
| 36 | 추가: work = project / "tests/work" / job | |
| 37 | 추가: configured = os.environ.get("ZIPELO_TEST_WORK_DIR") | |
| 38 | 추가: if configured and Path(configured).resolve() != work: | |
| 39 | 추가: raise ValueError("작업 폴더 밖의 표본 경로는 허용하지 않음") | |
| 40 | 추가: if work.resolve() != work: | |
| 41 | 추가: raise ValueError("안전한 작업 폴더가 필요함") | |
| 42 | 추가: return work | |
| 21 | 43 | |
| 22 | 44 | |
| 23 | 45 | class ZeroStream(io.RawIOBase): |
| @@ -103,7 +125,7 @@ def violations(artifact, limits): | ||
| 103 | 125 | |
| 104 | 126 | def build(directory, large=False): |
| 105 | 127 | directory = Path(directory).resolve() |
| 106 | 삭제: directory.relative_to(ROOT / "tests") | |
| 128 | 추가: directory.relative_to(work_root()) | |
| 107 | 129 | directory.mkdir(mode=0o700, parents=True, exist_ok=False) |
| 108 | 130 | cases = [] |
| 109 | 131 | artifacts = {} |
| @@ -196,8 +218,9 @@ def main(): | ||
| 196 | 218 | parser.add_argument("--output", required=True, type=Path, help="tests 아래의 새 디렉터리") |
| 197 | 219 | parser.add_argument("--large", action="store_true", help="1 GiB 성공과 16 GiB 초과 표본도 생성함") |
| 198 | 220 | args = parser.parse_args() |
| 199 | 삭제: manifest = build(args.output, args.large) | |
| 200 | 삭제: print(f"{len(manifest['cases'])} cases: {args.output / 'expectations.json'}") | |
| 221 | 추가: output = args.output if args.output.is_absolute() else work_root() / args.output | |
| 222 | 추가: manifest = build(output, args.large) | |
| 223 | 추가: print(f"{len(manifest['cases'])} cases: {output / 'expectations.json'}") | |
| 201 | 224 | |
| 202 | 225 | |
| 203 | 226 | if __name__ == "__main__": |
| @@ -11,7 +11,7 @@ import tempfile | ||
| 11 | 11 | import tarfile |
| 12 | 12 | import zipfile |
| 13 | 13 | |
| 14 | 삭제: from generate import CHUNK, NAME, ROOT, build, digest, violations | |
| 14 | 추가: from generate import CHUNK, NAME, ROOT, build, digest, violations, work_root | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | def check_payload(source, size): |
| @@ -49,7 +49,7 @@ def check_reference(path, artifact): | ||
| 49 | 49 | |
| 50 | 50 | def verify(directory, probe, worker, large=False): |
| 51 | 51 | directory = directory.resolve() |
| 52 | 삭제: directory.relative_to(ROOT / "tests") | |
| 52 | 추가: directory.relative_to(work_root()) | |
| 53 | 53 | manifest = json.loads((directory / "expectations.json").read_text(encoding="utf-8")) |
| 54 | 54 | assert not large or manifest["large"] |
| 55 | 55 | for name, artifact in manifest["artifacts"].items(): |
| @@ -108,22 +108,29 @@ def verify(directory, probe, worker, large=False): | ||
| 108 | 108 | return results |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 추가: def default_target(): | |
| 112 | 추가: return Path(os.environ.get("CARGO_TARGET_DIR", work_root() / "target")) / "debug" | |
| 113 | 추가: | |
| 114 | 추가: | |
| 111 | 115 | def main(): |
| 112 | 116 | parser = argparse.ArgumentParser() |
| 113 | 117 | parser.add_argument("--directory", type=Path, help="기존 표본 또는 새 표본 경로") |
| 114 | 118 | parser.add_argument("--large", action="store_true", help="1 GiB 성공과 16 GiB 초과도 검사함") |
| 115 | 삭제: target = Path(os.environ.get("CARGO_TARGET_DIR", ROOT / "tests/ci/target")) / "debug" | |
| 119 | 추가: target = default_target() | |
| 116 | 120 | suffix = ".exe" if os.name == "nt" else "" |
| 117 | 121 | parser.add_argument("--probe", type=Path, default=target / ("zipelo-large-archive-probe" + suffix)) |
| 118 | 122 | parser.add_argument("--worker", type=Path, default=target / ("zipelo-archive-worker" + suffix)) |
| 119 | 123 | args = parser.parse_args() |
| 120 | 124 | assert args.probe.is_file() and args.worker.is_file(), "local 빌드를 먼저 실행해야 함" |
| 121 | 125 | if args.directory: |
| 122 | 삭제: if not args.directory.exists(): | |
| 123 | 삭제: build(args.directory, args.large) | |
| 124 | 삭제: verify(args.directory, args.probe, args.worker, args.large) | |
| 126 | 추가: directory = args.directory if args.directory.is_absolute() else work_root() / args.directory | |
| 127 | 추가: if not directory.exists(): | |
| 128 | 추가: build(directory, args.large) | |
| 129 | 추가: verify(directory, args.probe, args.worker, args.large) | |
| 125 | 130 | else: |
| 126 | 삭제: with tempfile.TemporaryDirectory(prefix="fixture-", dir=ROOT / "tests/large-archive-fixtures") as scratch: | |
| 131 | 추가: work = work_root() | |
| 132 | 추가: work.mkdir(mode=0o700, parents=True, exist_ok=True) | |
| 133 | 추가: with tempfile.TemporaryDirectory(prefix="fixture-", dir=work) as scratch: | |
| 127 | 134 | directory = Path(scratch) / "corpus" |
| 128 | 135 | build(directory, args.large) |
| 129 | 136 | verify(directory, args.probe, args.worker, args.large) |
| @@ -23,7 +23,7 @@ python3 tests/ci/run_rust.py local | ||
| 23 | 23 | 단독 시험에서는 같은 target 디렉터리에 먼저 두 실행 파일을 빌드할 것. |
| 24 | 24 | |
| 25 | 25 | ```sh |
| 26 | 삭제: export CARGO_TARGET_DIR="$PWD/tests/ci/target" | |
| 26 | 추가: export CARGO_TARGET_DIR="$PWD/tests/work/rust-local/target" | |
| 27 | 27 | cargo +1.99.1 build --locked --manifest-path experiments/rust-archive-worker/Cargo.toml |
| 28 | 28 | cargo +1.99.1 build --locked --manifest-path tests/rust-app-real-worker/Cargo.toml |
| 29 | 29 | cargo +1.99.1 test --locked --all-features --manifest-path experiments/rust-ui-memory-app/Cargo.toml --test real_worker |
| @@ -1,4 +1,4 @@ | ||
| 1 | 삭제: use std::{collections::BTreeSet, path::Path}; | |
| 1 | 추가: use std::{collections::BTreeSet, path::{Path, PathBuf}}; | |
| 2 | 2 | use zipelo_ui_memory_app::{ |
| 3 | 3 | archive_dialog::archive_filters, |
| 4 | 4 | archive_present::{gzip_output_name, valid_output_leaf}, |
| @@ -147,10 +147,8 @@ fn missing_portal_returns_errors_for_every_dialog() { | ||
| 147 | 147 | } |
| 148 | 148 | return; |
| 149 | 149 | } |
| 150 | 삭제: let endpoint = Path::new(env!("CARGO_MANIFEST_DIR")).join(format!( | |
| 151 | 삭제: "../../tests/rust-app-ui/runs/no-bus-{}", | |
| 152 | 삭제: std::process::id() | |
| 153 | 삭제: )); | |
| 150 | 추가: let endpoint = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")) | |
| 151 | 추가: .join(format!("fixtures/rust-app-ui/no-bus-{}", std::process::id())); | |
| 154 | 152 | assert!(!endpoint.exists()); |
| 155 | 153 | let mut child = Command::new(std::env::current_exe().unwrap()) |
| 156 | 154 | .args([ |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | import os |
| 2 | 추가: import re | |
| 2 | 3 | from pathlib import Path |
| 3 | 4 | import select |
| 4 | 5 | import signal |
| @@ -7,11 +8,33 @@ import time | ||
| 7 | 8 | |
| 8 | 9 | |
| 9 | 10 | ROOT = Path(__file__).resolve().parents[2] |
| 10 | 삭제: OUTPUT = ROOT / "tests/rust-app-ui" / ("screens-" + str(time.time_ns())) | |
| 11 | 추가: | |
| 12 | 추가: | |
| 13 | 추가: def work_directory(): | |
| 14 | 추가: common = Path(subprocess.check_output( | |
| 15 | 추가: ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], | |
| 16 | 추가: cwd=ROOT, text=True, | |
| 17 | 추가: ).strip()).resolve() | |
| 18 | 추가: if common.name != ".git": | |
| 19 | 추가: raise RuntimeError("프로젝트 Git 작업 폴더를 찾을 수 없음") | |
| 20 | 추가: job = os.environ.get("ZIPELO_CI_JOB", "rust-local") | |
| 21 | 추가: if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_-]{0,63}", job): | |
| 22 | 추가: raise ValueError("안전한 작업명이 필요함") | |
| 23 | 추가: work = common.parent / "tests/work" / job | |
| 24 | 추가: if work.is_symlink() or not work.resolve().is_relative_to(common.parent / "tests/work"): | |
| 25 | 추가: raise ValueError("작업 폴더 밖의 경로는 허용하지 않음") | |
| 26 | 추가: return work | |
| 27 | 추가: | |
| 28 | 추가: | |
| 29 | 추가: def binary_path(work): | |
| 30 | 추가: target = Path(os.environ.get("CARGO_TARGET_DIR", work / "target")) | |
| 31 | 추가: return target / "debug/zipelo-ui-memory-app" | |
| 11 | 32 | |
| 12 | 33 | |
| 13 | 34 | def main(): |
| 14 | 삭제: OUTPUT.mkdir(exist_ok=True) | |
| 35 | 추가: work = work_directory() | |
| 36 | 추가: output = work / "screens" / str(time.time_ns()) | |
| 37 | 추가: output.mkdir(mode=0o700, parents=True) | |
| 15 | 38 | display = subprocess.Popen( |
| 16 | 39 | ["Xvfb", "-displayfd", "1", "-screen", "0", "1280x900x24", "-nolisten", "tcp"], |
| 17 | 40 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, start_new_session=True, |
| @@ -25,9 +48,9 @@ def main(): | ||
| 25 | 48 | raise RuntimeError("Xvfb display 응답 오류") |
| 26 | 49 | env = {**os.environ, "DISPLAY": ":" + number, "WINIT_UNIX_BACKEND": "x11"} |
| 27 | 50 | env.pop("WAYLAND_DISPLAY", None) |
| 28 | 삭제: with (OUTPUT / "app.stdout").open("wb") as stdout, (OUTPUT / "app.stderr").open("wb") as stderr: | |
| 51 | 추가: with (output / "app.stdout").open("wb") as stdout, (output / "app.stderr").open("wb") as stderr: | |
| 29 | 52 | app = subprocess.Popen( |
| 30 | 삭제: [str(ROOT / "tests/ci/target/debug/zipelo-ui-memory-app"), "--ui-fixture", "/synthetic/example.zip"], | |
| 53 | 추가: [str(binary_path(work)), "--ui-fixture", "/synthetic/example.zip"], | |
| 31 | 54 | env=env, stdout=stdout, stderr=stderr, start_new_session=True, |
| 32 | 55 | ) |
| 33 | 56 | deadline = time.monotonic() + 30 |
| @@ -41,9 +64,9 @@ def main(): | ||
| 41 | 64 | raise RuntimeError("소유 창 표시 시간 초과") |
| 42 | 65 | time.sleep(0.1) |
| 43 | 66 | time.sleep(1) |
| 44 | 삭제: subprocess.run(["import", "-window", "root", str(OUTPUT / "list.png")], env=env, timeout=10, check=True) | |
| 67 | 추가: subprocess.run(["import", "-window", "root", str(output / "list.png")], env=env, timeout=10, check=True) | |
| 45 | 68 | subprocess.run(["xdotool", "search", "--pid", str(app.pid), "--name", "Zipelo"], env=env, timeout=10, check=True) |
| 46 | 삭제: print(str(OUTPUT / "list.png")) | |
| 69 | 추가: print(str(output / "list.png")) | |
| 47 | 70 | finally: |
| 48 | 71 | for process in [app, display]: |
| 49 | 72 | if process is not None: |
| @@ -341,7 +341,7 @@ static SCRATCH_ID: AtomicU64 = AtomicU64::new(0); | ||
| 341 | 341 | pub(super) struct Folder(pub(super) PathBuf); |
| 342 | 342 | impl Folder { |
| 343 | 343 | pub(super) fn new() -> Self { |
| 344 | 삭제: let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/rust-app-ui/runs"); | |
| 344 | 추가: let root = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")).join("fixtures/rust-app-ui"); | |
| 345 | 345 | fs::create_dir_all(&root).unwrap(); |
| 346 | 346 | let path = root.join(format!( |
| 347 | 347 | "presentation-{}-{}", |
| @@ -598,8 +598,8 @@ mod linux { | ||
| 598 | 598 | measurements.join(", ") |
| 599 | 599 | ); |
| 600 | 600 | fs::write( |
| 601 | 삭제: PathBuf::from(env!("CARGO_MANIFEST_DIR")) | |
| 602 | 삭제: .join("../../tests/ci/seven-zip-streaming-rss.log"), | |
| 601 | 추가: PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")) | |
| 602 | 추가: .join("seven-zip-streaming-rss.log"), | |
| 603 | 603 | measurements.join("\n") + "\n", |
| 604 | 604 | ) |
| 605 | 605 | .unwrap(); |
| @@ -679,7 +679,8 @@ mod linux { | ||
| 679 | 679 | measurements.join(", ") |
| 680 | 680 | ); |
| 681 | 681 | fs::write( |
| 682 | 삭제: PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../tests/ci/streaming-rss.log"), | |
| 682 | 추가: PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")) | |
| 683 | 추가: .join("streaming-rss.log"), | |
| 683 | 684 | measurements.join("\n") + "\n", |
| 684 | 685 | ) |
| 685 | 686 | .unwrap(); |
| @@ -14,12 +14,8 @@ static NEXT: AtomicU64 = AtomicU64::new(0); | ||
| 14 | 14 | struct Scratch(PathBuf); |
| 15 | 15 | impl Scratch { |
| 16 | 16 | fn new() -> Self { |
| 17 | 삭제: let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) | |
| 18 | 삭제: .parent() | |
| 19 | 삭제: .unwrap() | |
| 20 | 삭제: .parent() | |
| 21 | 삭제: .unwrap() | |
| 22 | 삭제: .join("tests/rust-archive-worker/runs") | |
| 17 | 추가: let path = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")) | |
| 18 | 추가: .join("fixtures/rust-archive-worker") | |
| 23 | 19 | .join(format!( |
| 24 | 20 | "{}-{}", |
| 25 | 21 | std::process::id(), |
| @@ -119,7 +119,7 @@ | ||
| 119 | 119 | }, |
| 120 | 120 | "fixture_provenance": { |
| 121 | 121 | "inputs": "Only source-defined pattern(i)=(i*37+11)%251, fixed literals and bounded repeated bytes. No archive or user-file inputs.", |
| 122 | 삭제: "paths": "Future approved runner exclusively creates mode-0700 tests/rust-file-publication/runs. Each case creates exclusive case-PID-counter and a mode-0700 parent. Tests may only publish/create/move/remove their own synthetic paths. No global cwd, environment, umask, permission or ownership changes.", | |
| 122 | 추가: "paths": "Future approved runner exclusively creates mode-0700 tests/work/<작업명>/fixtures/rust-file-publication. Each case creates exclusive case-PID-counter and a mode-0700 parent. Tests may only publish/create/move/remove their own synthetic paths. No global cwd, environment, umask, permission or ownership changes.", | |
| 123 | 123 | "special_files": "Synthetic FIFO through existing libc::mkfifo, unconnected local Unix socket, symlinks and hard links. No device nodes, mounts or system special-file writes.", |
| 124 | 124 | "filesystem": "Linux magic ef53 (ext family) or 58465342 (XFS), exclusively managed by effective UID. The current tests directory reports ef53 in read-only stat inspection; O_TMPFILE/linkat/fsync are unverified until execution. Unsupported environment must stop, not skip or silently fall back.", |
| 125 | 125 | "boundaries": [ |
| @@ -2,9 +2,10 @@ use crate::support::*; | ||
| 2 | 2 | use publication::{Error, Limits, Publication, Request, Stop, Usage}; |
| 3 | 3 | use std::{ |
| 4 | 4 | ffi::{CString, OsStr, OsString}, |
| 5 | 삭제: fs, | |
| 5 | 추가: fs::{self, File}, | |
| 6 | 6 | os::unix::{ |
| 7 | 7 | ffi::{OsStrExt, OsStringExt}, |
| 8 | 추가: io::AsRawFd, | |
| 8 | 9 | fs::{FileTypeExt, MetadataExt, symlink}, |
| 9 | 10 | net::UnixListener, |
| 10 | 11 | }, |
| @@ -172,10 +173,14 @@ enum Existing { | ||
| 172 | 173 | } |
| 173 | 174 | |
| 174 | 175 | fn bind_socket(output: &Path) -> UnixListener { |
| 175 | 삭제: // Cargo 시험의 현재 디렉터리 기준으로 소켓 주소만 짧게 지정함. | |
| 176 | 삭제: let current = std::env::current_dir().unwrap(); | |
| 177 | 삭제: let relative = output.strip_prefix(¤t).unwrap(); | |
| 178 | 삭제: UnixListener::bind(relative).unwrap() | |
| 176 | 추가: // 디렉터리 핸들로 긴 절대 경로를 소켓 주소에서 제외함. | |
| 177 | 추가: let parent = File::open(output.parent().unwrap()).unwrap(); | |
| 178 | 추가: let address = format!( | |
| 179 | 추가: "/proc/self/fd/{}/{}", | |
| 180 | 추가: parent.as_raw_fd(), | |
| 181 | 추가: output.file_name().unwrap().to_string_lossy() | |
| 182 | 추가: ); | |
| 183 | 추가: UnixListener::bind(address).unwrap() | |
| 179 | 184 | } |
| 180 | 185 | |
| 181 | 186 | #[test] |
| @@ -19,7 +19,7 @@ pub struct Sandbox { | ||
| 19 | 19 | |
| 20 | 20 | impl Sandbox { |
| 21 | 21 | pub fn new() -> Self { |
| 22 | 삭제: let runs = Path::new(env!("CARGO_MANIFEST_DIR")).join("runs"); | |
| 22 | 추가: let runs = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")).join("fixtures/rust-file-publication"); | |
| 23 | 23 | let info = fs::symlink_metadata(&runs).expect("runner가 전용 runs를 준비해야 함"); |
| 24 | 24 | assert!(info.is_dir() && !info.file_type().is_symlink()); |
| 25 | 25 | assert_eq!(info.mode() & 0o777, 0o700); |
| @@ -210,7 +210,7 @@ | ||
| 210 | 210 | "<fixed-binary> --exact <contract-name> --test-threads=1 --nocapture" |
| 211 | 211 | ], |
| 212 | 212 | "toolchain": "Existing 1.99.1-x86_64-unknown-linux-gnu explicitly selected; default stable lacks rustfmt. No toolchain installation or shared override.", |
| 213 | 삭제: "sandbox_precondition": "Approved runner creates tests/rust-file-snapshot/runs with mode 0700 before tests, verifies no symlink and expected owner, and refuses leftover case directories. No sandbox or synthetic input has been created at source-only stage." | |
| 213 | 추가: "sandbox_precondition": "Approved runner creates tests/work/<작업명>/fixtures/rust-file-snapshot with mode 0700 before tests, verifies no symlink and expected owner, and refuses leftover case directories. No sandbox or synthetic input has been created at source-only stage." | |
| 214 | 214 | }, |
| 215 | 215 | "static_validation": { |
| 216 | 216 | "allowed": [ |
| @@ -16,7 +16,7 @@ pub struct Sandbox { | ||
| 16 | 16 | |
| 17 | 17 | impl Sandbox { |
| 18 | 18 | pub fn new() -> Self { |
| 19 | 삭제: let parent = Path::new(env!("CARGO_MANIFEST_DIR")).join("runs"); | |
| 19 | 추가: let parent = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")).join("fixtures/rust-file-snapshot"); | |
| 20 | 20 | let metadata = fs::symlink_metadata(&parent).expect("runner가 runs 디렉터리를 준비해야 함"); |
| 21 | 21 | assert!(metadata.is_dir() && !metadata.file_type().is_symlink()); |
| 22 | 22 | assert_eq!(metadata.mode() & 0o777, 0o700); |
| @@ -22,7 +22,7 @@ pub struct Sandbox { | ||
| 22 | 22 | |
| 23 | 23 | impl Sandbox { |
| 24 | 24 | pub fn new() -> Self { |
| 25 | 삭제: let runs = Path::new(env!("CARGO_MANIFEST_DIR")).join("runs"); | |
| 25 | 추가: let runs = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")).join("fixtures/rust-gzip-file-job"); | |
| 26 | 26 | let info = fs::symlink_metadata(&runs).expect("runner가 전용 runs를 준비해야 함"); |
| 27 | 27 | assert!(info.is_dir() && !info.file_type().is_symlink()); |
| 28 | 28 | assert_eq!(info.mode() & 0o777, 0o700); |
| @@ -58,7 +58,7 @@ fn directory(path: &Path) { | ||
| 58 | 58 | #[test] |
| 59 | 59 | fn zip64_tool_and_field_corpus_lists_and_extracts() { |
| 60 | 60 | let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); |
| 61 | 삭제: let runs = root.join("runs"); | |
| 61 | 추가: let runs = PathBuf::from(std::env::var_os("ZIPELO_TEST_WORK_DIR").expect("runner 작업 경로 필요")).join("fixtures/rust-zip64-compat"); | |
| 62 | 62 | fs::create_dir_all(&runs).unwrap(); |
| 63 | 63 | let scratch = runs.join(format!( |
| 64 | 64 | "{}-{}", |