File size: 1,130 Bytes
ceea884
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""src/vkgs/src/render_graph.cpp ์˜ ์ •๋ ฌยท๋ฐฐ๋ฆฌ์–ด ๋กœ์ง์„ g++ ๋กœ ์ปดํŒŒ์ผํ•ด ์‹œํ—˜ํ•œ๋‹ค. GPUยท์ฐฝ ์—†์Œ
(vkCmdPipelineBarrier ๋Š” ์‹œํ—˜ ์ชฝ ๊ฐ€์งœ๊ฐ€ ๊ธฐ๋กํ•œ๋‹ค)."""

import os
import shutil
import subprocess
from pathlib import Path

import pytest

ROOT = Path(__file__).resolve().parents[1]
# ๋ทฐ์–ด ๋นŒ๋“œ์™€ ๊ฐ™์€ ์ปดํŒŒ์ผ๋Ÿฌ (conda gcc 12, $CXX). ์‹œ์Šคํ…œ g++ 9 ๋Š” C++20 ์„ ๋ชจ๋ฅธ๋‹ค
CXX = os.environ.get("CXX") or "g++"


@pytest.mark.skipif(shutil.which(CXX) is None, reason="g++ ์—†์Œ")
def test_render_graph(tmp_path):
    exe = tmp_path / "t"
    inc = [str(ROOT / "src/vkgs/src"), str(ROOT / "third_party")]
    if os.environ.get("CONDA_PREFIX"):
        inc.append(os.environ["CONDA_PREFIX"] + "/include")
    subprocess.run([CXX, "-std=c++20", "-O1", *(f"-I{d}" for d in inc),
                    str(ROOT / "tests/cpp/test_render_graph.cpp"), str(ROOT / "src/vkgs/src/render_graph.cpp"),
                    "-o", str(exe)], check=True)
    r = subprocess.run([str(exe), str(ROOT / "configs/render_graph.json")], capture_output=True, text=True)
    assert r.returncode == 0, r.stdout + r.stderr