시험 결과를 작업 폴더에 모음
- 작성자
- 코노모리 카논
- 작성 시각
- 커밋
838637f96de8fab4b56534fb1c4f87bd56ed2088- 부모
- ff0fad1
변경된 파일 20개
+132-64| @@ -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,32 @@ 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 | 추가: base = project / "tests/work" | |
| 35 | 추가: base.mkdir(parents=True, exist_ok=True) | |
| 36 | 추가: path = base / name | |
| 37 | 추가: if path.is_symlink() or (path.exists() and not path.is_dir()): | |
| 38 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {path}") | |
| 39 | 추가: path.mkdir(mode=0o700, exist_ok=True) | |
| 40 | 추가: if path.resolve() != path: | |
| 41 | 추가: raise ValueError(f"안전한 작업 디렉터리가 필요함: {path}") | |
| 42 | 추가: return path | |
| 43 | 추가: | |
| 44 | 추가: | |
| 45 | 추가: def test_work_directory(root): | |
| 46 | 추가: return Path(os.environ.get("ZIPELO_TEST_WORK_DIR", root / "tests/work/rust-local")) | |
| 47 | 추가: | |
| 48 | 추가: | |
| 22 | 49 | |
| 23 | 50 | |
| 24 | 51 | def manifests(root): |
| @@ -53,9 +80,9 @@ def command(manifest, phase): | ||
| 53 | 80 | def prepare_fixtures(root): |
| 54 | 81 | skipped = {} |
| 55 | 82 | for name in sorted(FILE_FIXTURES): |
| 56 | 삭제: path = root / "tests" / name / "runs" | |
| 83 | 추가: path = test_work_directory(root) / "fixtures" / name | |
| 57 | 84 | if not path.exists() and not path.is_symlink(): |
| 58 | 삭제: path.mkdir(mode=0o700) | |
| 85 | 추가: path.mkdir(mode=0o700, parents=True) | |
| 59 | 86 | info = path.lstat() |
| 60 | 87 | if ( |
| 61 | 88 | not stat.S_ISDIR(info.st_mode) |
| @@ -124,7 +151,7 @@ def prepare_tools(root): | ||
| 124 | 151 | if configured: |
| 125 | 152 | directories = [Path(configured).resolve()] |
| 126 | 153 | else: |
| 127 | 삭제: directories = [root / "tests/ci/tools"] | |
| 154 | 추가: directories = [test_work_directory(root) / "tools"] | |
| 128 | 155 | common = Path(subprocess.check_output( |
| 129 | 156 | ["git", "rev-parse", "--path-format=absolute", "--git-common-dir"], |
| 130 | 157 | cwd=root, text=True, |
| @@ -169,7 +196,10 @@ def prepare_local_tools(root): | ||
| 169 | 196 | prepare_cross_build() |
| 170 | 197 | except ValueError: |
| 171 | 198 | print("Windows 교차 도구를 프로젝트 내부에 준비함: tests/ci/setup_windows.sh", flush=True) |
| 172 | 삭제: subprocess.run(["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, check=True) | |
| 199 | 추가: environment = dict(os.environ, ZIPELO_CI_TOOLS=str(test_work_directory(root) / "tools")) | |
| 200 | 추가: subprocess.run(["bash", str(root / "tests/ci/setup_windows.sh")], | |
| 201 | 추가: cwd=root, env=environment, check=True) | |
| 202 | 추가: os.environ["ZIPELO_CI_TOOLS"] = environment["ZIPELO_CI_TOOLS"] | |
| 173 | 203 | prepare_tools(root) |
| 174 | 204 | prepare_cross_build() |
| 175 | 205 | |
| @@ -191,12 +221,22 @@ def execute_phases(root, phases): | ||
| 191 | 221 | def main(): |
| 192 | 222 | parser = argparse.ArgumentParser(description="로컬 Linux 시험과 Windows 교차 빌드") |
| 193 | 223 | parser.add_argument("phase", choices=["local", "build", "test", "cross-build"]) |
| 224 | 추가: parser.add_argument("--job", default=os.environ.get("ZIPELO_CI_JOB", "rust-local")) | |
| 194 | 225 | args = parser.parse_args() |
| 195 | 226 | if args.phase == "local" and sys.platform != "linux": |
| 196 | 227 | parser.error("local 모드는 Linux에서 실행해야 함") |
| 197 | 삭제: prepare_tools(ROOT) | |
| 228 | 추가: work = work_directory(ROOT, args.job) | |
| 229 | 추가: temporary = work / "tmp" | |
| 230 | 추가: temporary.mkdir(mode=0o700, exist_ok=True) | |
| 231 | 추가: os.environ["ZIPELO_CI_JOB"] = args.job | |
| 232 | 추가: os.environ["ZIPELO_TEST_WORK_DIR"] = str(work) | |
| 233 | 추가: os.environ["TMPDIR"] = str(temporary) | |
| 234 | 추가: os.environ["TMP"] = str(temporary) | |
| 235 | 추가: os.environ["TEMP"] = str(temporary) | |
| 236 | 추가: os.environ["PYTHONDONTWRITEBYTECODE"] = "1" | |
| 198 | 237 | os.environ.setdefault("CARGO_BUILD_JOBS", "2") |
| 199 | 삭제: os.environ.setdefault("CARGO_TARGET_DIR", str(ROOT / "tests/ci/target")) | |
| 238 | 추가: os.environ["CARGO_TARGET_DIR"] = str(work / "target") | |
| 239 | 추가: prepare_tools(ROOT) | |
| 200 | 240 | phases = ["build", "test", "cross-build"] if args.phase == "local" else [args.phase] |
| 201 | 241 | checks = subprocess.run( |
| 202 | 242 | [sys.executable, "-m", "unittest", "discover", "-s", "tests/ci", "-p", "test_*.py"], |
| @@ -227,7 +267,7 @@ def main(): | ||
| 227 | 267 | "windows_runtime_tested": checks.returncode == 0 and sys.platform == "win32" and "test" in phases, |
| 228 | 268 | "results": results, |
| 229 | 269 | } |
| 230 | 삭제: (ROOT / f"tests/ci/{args.phase}-results.json").write_text( | |
| 270 | 추가: (work / f"{args.phase}-results.json").write_text( | |
| 231 | 271 | json.dumps(report, ensure_ascii=False, indent=4) + "\n", encoding="utf-8" |
| 232 | 272 | ) |
| 233 | 273 | 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 |
| @@ -13,7 +13,7 @@ HELPER = ROOT / "packaging/ubuntu/rust/default-apps" | ||
| 13 | 13 | |
| 14 | 14 | class DefaultAppsTests(unittest.TestCase): |
| 15 | 15 | def setUp(self): |
| 16 | 삭제: work = ROOT / "tests/work" | |
| 16 | 추가: work = Path(os.environ["ZIPELO_TEST_WORK_DIR"]) | |
| 17 | 17 | work.mkdir(exist_ok=True) |
| 18 | 18 | self.temporary = tempfile.TemporaryDirectory(dir=work) |
| 19 | 19 | self.addCleanup(self.temporary.cleanup) |
| @@ -11,8 +11,8 @@ ROOT = Path(__file__).resolve().parents[2] | ||
| 11 | 11 | class IconBuildTests(unittest.TestCase): |
| 12 | 12 | @classmethod |
| 13 | 13 | def setUpClass(cls): |
| 14 | 삭제: (ROOT / "tests/work").mkdir(parents=True, exist_ok=True) | |
| 15 | 삭제: cls.scratch = tempfile.TemporaryDirectory(dir=ROOT / "tests/work") | |
| 14 | 추가: work = Path(os.environ["ZIPELO_TEST_WORK_DIR"]) | |
| 15 | 추가: cls.scratch = tempfile.TemporaryDirectory(dir=work) | |
| 16 | 16 | cls.addClassCleanup(cls.scratch.cleanup) |
| 17 | 17 | cls.root = Path(cls.scratch.name) |
| 18 | 18 | cls.builder = cls.root / "build.exe" |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import gzip |
| 2 | 2 | import importlib.util |
| 3 | 3 | import io |
| 4 | 추가: import os | |
| 4 | 5 | from pathlib import Path |
| 5 | 6 | import tarfile |
| 6 | 7 | import tempfile |
| @@ -18,7 +19,7 @@ SPEC.loader.exec_module(GENERATOR) | ||
| 18 | 19 | |
| 19 | 20 | class LargeArchiveFixtureTests(unittest.TestCase): |
| 20 | 21 | def test_boundary_archives_are_valid_and_expectations_straddle_limit(self): |
| 21 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 22 | 추가: with tempfile.TemporaryDirectory(dir=os.environ["ZIPELO_TEST_WORK_DIR"]) as scratch: | |
| 22 | 23 | directory = Path(scratch) / "corpus" |
| 23 | 24 | manifest = GENERATOR.build(directory) |
| 24 | 25 | self.assertEqual(len(manifest["cases"]), 11) |
| @@ -52,7 +53,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 52 | 53 | self.assertEqual(case["expected"]["created_count"], 0 if failed else 1) |
| 53 | 54 | |
| 54 | 55 | def test_former_ratio_samples_all_expect_success(self): |
| 55 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 56 | 추가: with tempfile.TemporaryDirectory(dir=os.environ["ZIPELO_TEST_WORK_DIR"]) as scratch: | |
| 56 | 57 | manifest = GENERATOR.build(Path(scratch) / "corpus") |
| 57 | 58 | for suffix, delta in (("below", -1), ("equal", 0), ("above", 1)): |
| 58 | 59 | name = "ratio-" + suffix + ".gz" |
| @@ -66,7 +67,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 66 | 67 | self.assertEqual(payload, bytes(artifact["payload_bytes"])) |
| 67 | 68 | |
| 68 | 69 | def test_generator_rejects_existing_destination_without_changes(self): |
| 69 | 삭제: with tempfile.TemporaryDirectory(dir=ROOT / "tests/ci") as scratch: | |
| 70 | 추가: with tempfile.TemporaryDirectory(dir=os.environ["ZIPELO_TEST_WORK_DIR"]) as scratch: | |
| 70 | 71 | directory = Path(scratch) |
| 71 | 72 | marker = directory / "keep" |
| 72 | 73 | marker.write_bytes(b"preserve") |
| @@ -77,7 +78,7 @@ class LargeArchiveFixtureTests(unittest.TestCase): | ||
| 77 | 78 | |
| 78 | 79 | def test_generator_requires_project_test_directory(self): |
| 79 | 80 | with self.assertRaises(ValueError): |
| 80 | 삭제: GENERATOR.build(ROOT / "outside-tests") | |
| 81 | 추가: GENERATOR.build(Path(os.environ["ZIPELO_TEST_WORK_DIR"]).parent / "outside-tests") | |
| 81 | 82 | |
| 82 | 83 | def test_payload_source_enforces_bounded_reads(self): |
| 83 | 84 | source = GENERATOR.ZeroStream(GENERATOR.GIB) |
| @@ -1,17 +1,34 @@ | ||
| 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(run_rust.ROOT, os.environ["ZIPELO_CI_JOB"]), TEST_WORK) | |
| 26 | 추가: | |
| 27 | 추가: def test_cargo_and_temp_paths_are_kept_in_job_directory(self): | |
| 28 | 추가: for key in ("CARGO_TARGET_DIR", "TMPDIR", "TMP", "TEMP", "ZIPELO_TEST_WORK_DIR"): | |
| 29 | 추가: with self.subTest(key=key): | |
| 30 | 추가: self.assertTrue(Path(os.environ[key]).resolve().is_relative_to(TEST_WORK)) | |
| 31 | 추가: | |
| 15 | 32 | def test_all_manifests_have_locks(self): |
| 16 | 33 | paths = run_rust.manifests(run_rust.ROOT) |
| 17 | 34 | expected = set(run_rust.ROOT.glob("experiments/*/Cargo.toml")) |
| @@ -84,13 +101,14 @@ class RunnerTests(unittest.TestCase): | ||
| 84 | 101 | def test_self_check_failure_replaces_previous_success_report(self): |
| 85 | 102 | for phase, platform in (("local", "linux"), ("test", "win32")): |
| 86 | 103 | with self.subTest(phase=phase), tempfile.TemporaryDirectory( |
| 87 | 삭제: dir=run_rust.ROOT / "tests/ci" | |
| 104 | 추가: dir=TEST_WORK | |
| 88 | 105 | ) as directory: |
| 89 | 106 | root = Path(directory) |
| 90 | 삭제: (root / "tests/ci").mkdir(parents=True) | |
| 91 | 삭제: report_path = root / f"tests/ci/{phase}-results.json" | |
| 107 | 추가: (root / "work/tmp").mkdir(parents=True) | |
| 108 | 추가: report_path = root / f"work/{phase}-results.json" | |
| 92 | 109 | with ( |
| 93 | 110 | patch.object(run_rust, "ROOT", root), |
| 111 | 추가: patch.object(run_rust, "work_directory", return_value=root / "work"), | |
| 94 | 112 | patch.object(run_rust, "prepare_tools"), |
| 95 | 113 | patch.object(run_rust, "prepare_local_tools"), |
| 96 | 114 | patch.object(run_rust.sys, "argv", ["run_rust.py", phase]), |
| @@ -125,7 +143,7 @@ class RunnerTests(unittest.TestCase): | ||
| 125 | 143 | |
| 126 | 144 | @unittest.skipUnless(sys.platform == "linux", "Linux MinGW 실행 파일 탐색 시험임") |
| 127 | 145 | def test_linked_worktree_finds_setup_tools_without_path_export(self): |
| 128 | 삭제: with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: | |
| 146 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 129 | 147 | base = Path(directory) |
| 130 | 148 | root = base / "linked" |
| 131 | 149 | tools = base / "tests/ci/tools" |
| @@ -159,7 +177,7 @@ class RunnerTests(unittest.TestCase): | ||
| 159 | 177 | ): |
| 160 | 178 | run_rust.prepare_local_tools(root) |
| 161 | 179 | setup.assert_called_once_with( |
| 162 | 삭제: ["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, check=True, | |
| 180 | 추가: ["bash", str(root / "tests/ci/setup_windows.sh")], cwd=root, env=ANY, check=True, | |
| 163 | 181 | ) |
| 164 | 182 | reload.assert_called_once_with(root) |
| 165 | 183 | self.assertEqual(detect.call_count, 2) |
| @@ -184,10 +202,10 @@ class RunnerTests(unittest.TestCase): | ||
| 184 | 202 | |
| 185 | 203 | @unittest.skipUnless(sys.platform == "linux", "Linux 파일시스템과 소유권 검사 시험임") |
| 186 | 204 | def test_filesystem_skip_is_limited_to_publication_test_crates(self): |
| 187 | 삭제: with tempfile.TemporaryDirectory(dir=run_rust.ROOT / "tests/ci") as directory: | |
| 205 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 188 | 206 | root = Path(directory) |
| 189 | 삭제: for name in run_rust.FILE_FIXTURES: | |
| 190 | 삭제: (root / "tests" / name).mkdir(parents=True) | |
| 207 | 추가: work = root / "work" | |
| 208 | 추가: work.mkdir() | |
| 191 | 209 | paths = [ |
| 192 | 210 | root / "tests/rust-file-publication/Cargo.toml", |
| 193 | 211 | root / "tests/rust-gzip-file-job/Cargo.toml", |
| @@ -196,6 +214,7 @@ class RunnerTests(unittest.TestCase): | ||
| 196 | 214 | ] |
| 197 | 215 | with ( |
| 198 | 216 | patch.object(run_rust, "manifests", return_value=paths), |
| 217 | 추가: patch.dict(run_rust.os.environ, {"ZIPELO_TEST_WORK_DIR": str(work)}), | |
| 199 | 218 | patch.object(run_rust.subprocess, "check_output", return_value="1021994\n"), |
| 200 | 219 | patch.object(run_rust.subprocess, "run", return_value=subprocess.CompletedProcess([], 0)) as cargo, |
| 201 | 220 | ): |
| @@ -212,18 +231,19 @@ class RunnerTests(unittest.TestCase): | ||
| 212 | 231 | |
| 213 | 232 | @unittest.skipUnless(sys.platform == "linux", "Linux 소켓 경로 회귀 시험임") |
| 214 | 233 | 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: | |
| 234 | 추가: with tempfile.TemporaryDirectory(dir=TEST_WORK) as directory: | |
| 218 | 235 | root = Path(directory) / ("long-checkout-" * 10) |
| 219 | 삭제: for name in run_rust.FILE_FIXTURES: | |
| 220 | 삭제: (root / "tests" / name).mkdir(parents=True) | |
| 236 | 추가: work = Path(directory) / "work" | |
| 221 | 237 | socket = root / "tests/rust-file-publication/runs/case-1-1/parent/output" |
| 222 | 238 | self.assertGreaterEqual(len(run_rust.os.fsencode(socket)), 108) |
| 223 | 삭제: with patch.object(run_rust.subprocess, "check_output", return_value="ef53\n"): | |
| 239 | 추가: with ( | |
| 240 | 추가: patch.dict(run_rust.os.environ, {"ZIPELO_TEST_WORK_DIR": str(work)}), | |
| 241 | 추가: patch.object(run_rust.subprocess, "check_output", return_value="ef53\n"), | |
| 242 | 추가: ): | |
| 224 | 243 | self.assertEqual(run_rust.prepare_fixtures(root), {}) |
| 225 | 244 | for name in run_rust.FILE_FIXTURES: |
| 226 | 삭제: self.assertEqual(list((root / "tests" / name / "runs").iterdir()), []) | |
| 245 | 추가: self.assertEqual(list((work / "fixtures" / name).iterdir()), []) | |
| 246 | 추가: self.assertFalse((root / "tests" / name / "runs").exists()) | |
| 227 | 247 | |
| 228 | 248 | def test_unknown_filesystem_probe_error_is_failure(self): |
| 229 | 249 | 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 |
| @@ -18,7 +19,7 @@ SPEC.loader.exec_module(MODULE) | ||
| 18 | 19 | |
| 19 | 20 | class InstallerInputTests(unittest.TestCase): |
| 20 | 21 | def setUp(self): |
| 21 | 삭제: runs = ROOT / "tests/windows-installer/runs" | |
| 22 | 추가: runs = Path(os.environ["ZIPELO_TEST_WORK_DIR"]) / "fixtures/windows-installer" | |
| 22 | 23 | runs.mkdir(parents=True, exist_ok=True) |
| 23 | 24 | self.directory = tempfile.TemporaryDirectory(dir=runs) |
| 24 | 25 | self.addCleanup(self.directory.cleanup) |
| @@ -5,6 +5,7 @@ import gzip | ||
| 5 | 5 | import hashlib |
| 6 | 6 | import io |
| 7 | 7 | import json |
| 8 | 추가: import os | |
| 8 | 9 | from pathlib import Path |
| 9 | 10 | import struct |
| 10 | 11 | import tarfile |
| @@ -103,7 +104,7 @@ def violations(artifact, limits): | ||
| 103 | 104 | |
| 104 | 105 | def build(directory, large=False): |
| 105 | 106 | directory = Path(directory).resolve() |
| 106 | 삭제: directory.relative_to(ROOT / "tests") | |
| 107 | 추가: directory.relative_to(Path(os.environ["ZIPELO_TEST_WORK_DIR"]).resolve()) | |
| 107 | 108 | directory.mkdir(mode=0o700, parents=True, exist_ok=False) |
| 108 | 109 | cases = [] |
| 109 | 110 | artifacts = {} |
| @@ -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([ |
| @@ -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-{}-{}", |
| @@ -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 | "{}-{}", |