Skip to content

Commit

Permalink
Execute aspect integration tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
martis42 committed Jan 18, 2024
1 parent a60f597 commit 7e6af1e
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
integration-tests-aspect:
strategy:
matrix:
os: [ ubuntu-22.04, macos-12 ]
os: [ ubuntu-22.04, macos-12, windows-2022 ]
runs-on: ${{ matrix.os }}
needs: [ fast-tests ]
steps:
Expand Down
4 changes: 3 additions & 1 deletion test/aspect/alias/test_invalid_dependency_through_alias.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -6,7 +8,7 @@ class TestCase(TestCaseBase):
def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=["File='alias/use_a_and_b.cpp', include='alias/a.h'"],
invalid_includes=[f"File='{Path('alias/use_a_and_b.cpp')}', include='alias/a.h'"],
)
actual = self._run_dwyu(target="//alias:use_a_transitively", aspect=self.default_aspect)

Expand Down
6 changes: 3 additions & 3 deletions test/aspect/defines/defines_from_bazel_target.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifdef SOME_DEFINE
#include "defines/support/a.h"
#else
#include "defines/support/b.h"
#include "non/existing/a.h"
#endif

#ifdef LOCAL_DEFINE
#include "defines/support/a.h"
#else
#include "defines/support/b.h"
#include "non/existing/b.h"
#endif

#if SOME_COPT > 40
#include "defines/support/a.h"
#else
#include "defines/support/b.h"
#include "non/existing/c.h"
#endif
6 changes: 3 additions & 3 deletions test/aspect/defines/transitive_defines_from_bazel_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifdef TRANSITIVE_DEFINE
#include "defines/support/a.h"
#else
#include "defines/support/b.h"
#include "non/existing/a.h"
#endif

#include "defines/support/a.h"
Expand All @@ -13,9 +13,9 @@
// 'local_defines' which should not leak to users of the target

#ifdef LOCAL_DEFINE
#include "defines/support/b.h"
#include "non/existing/b.h"
#endif

#ifdef LOCAL_COPT
#include "defines/support/b.h"
#include "non/existing/c.h"
#endif
3 changes: 1 addition & 2 deletions test/aspect/execution_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import subprocess
from importlib.machinery import SourceFileLoader
from os import environ
from pathlib import Path
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -75,7 +74,7 @@ def main(
versions = [TestedVersions(bazel=bazel, python=python)] if bazel and python else tested_versions

failed_tests = []
output_root = Path(environ["HOME"]) / ".cache" / "bazel" / workspace_path.relative_to("/")
output_root = Path.home() / ".cache" / "bazel" / "dwyu"
for version in versions:
output_base = output_root / f"aspect_integration_tests_bazel_{version.bazel}_python_{version.python}"
output_base.mkdir(parents=True, exist_ok=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -7,7 +9,7 @@ def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=[
"File='ignore_includes/use_not_ignored_header.h', include='example_substring_matching_does_not_work_here.h'"
f"File='{Path('ignore_includes/use_not_ignored_header.h')}', include='example_substring_matching_does_not_work_here.h'"
],
)
actual = self._run_dwyu(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -6,7 +8,7 @@ class TestCase(TestCaseBase):
def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=["File='target_mapping/use_lib_c.cpp', include='target_mapping/libs/c.h'"],
invalid_includes=[f"File='{Path('target_mapping/use_lib_c.cpp')}', include='target_mapping/libs/c.h'"],
unused_public_deps=["//target_mapping/libs:a"],
)
actual = self._run_dwyu(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -6,7 +8,7 @@ class TestCase(TestCaseBase):
def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=["File='target_mapping/use_lib_c.cpp', include='target_mapping/libs/c.h'"],
invalid_includes=[f"File='{Path('target_mapping/use_lib_c.cpp')}', include='target_mapping/libs/c.h'"],
unused_public_deps=["//target_mapping/libs:a"],
)
actual = self._run_dwyu(
Expand Down
6 changes: 5 additions & 1 deletion test/aspect/tree_artifact/test_invalid_tree_artifact.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -7,7 +9,9 @@ def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
# We omit "File='bazel-out/<compilation_mode_and_platform> to allow testing in various environments
invalid_includes=["/bin/tree_artifact/sources.cc/tree_lib.cc', include='tree_artifact/some_lib.h'"],
invalid_includes=[
f"{Path('/bin/tree_artifact/sources.cc/tree_lib.cc')}', include='tree_artifact/some_lib.h'"
],
)
actual = self._run_dwyu(
target="//tree_artifact:tree_artifact_library",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -6,7 +8,7 @@ class TestCase(TestCaseBase):
def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=["File='using_transitive_dep/main.cpp', include='using_transitive_dep/foo.h'"],
invalid_includes=[f"File='{Path('using_transitive_dep/main.cpp')}', include='using_transitive_dep/foo.h'"],
)
actual = self._run_dwyu(target="//using_transitive_dep:main", aspect=self.default_aspect)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from result import ExpectedResult, Result
from test_case import TestCaseBase

Expand All @@ -7,7 +9,7 @@ def execute_test_logic(self) -> Result:
expected = ExpectedResult(
success=False,
invalid_includes=[
"File='using_transitive_dep/transitive_usage_through_impl_deps.h', include='using_transitive_dep/foo.h'"
f"File='{Path('using_transitive_dep/transitive_usage_through_impl_deps.h')}', include='using_transitive_dep/foo.h'"
],
)
actual = self._run_dwyu(
Expand Down

0 comments on commit 7e6af1e

Please sign in to comment.