-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the apsect tests proper integration tests
Incorporating bzlmod and creating the examples showed us that we overlooked problems due to the old test setup not being real integration tests. Now DWYU is a proper external dependency for the integration tests, as it is in the examples.
- Loading branch information
Showing
104 changed files
with
350 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# When working with hermetic Python toolchains, supporting the legacy runfiles layout is needlessly wasting resources. | ||
# See https://github.com/bazelbuild/rules_python/issues/1653 | ||
common --nolegacy_external_runfiles | ||
|
||
# The symlinks are annoying | ||
common --experimental_convenience_symlinks=clean | ||
|
||
# The performance gains offered by the lockfile are minimal for us. | ||
# Pinning the dependencies should be superfluous from a reproducibility perspective as the central registry is supposed | ||
# to be immutable for a module X in version Y after it has ben registered with the registry (ignoring the possibility of | ||
# yanking a module). Furthermore, the module resolution is deterministic. | ||
# However, there are several open issues suggesting the lock file will change in one way or another. | ||
# Thus, we don't use the bzlmod locking yet. | ||
common --lockfile_mode=off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
module( | ||
name = "dwyu_aspect_integration_tests", | ||
compatibility_level = 0, | ||
) | ||
|
||
bazel_dep( | ||
name = "depend_on_what_you_use", | ||
version = "0.0.0", | ||
dev_dependency = True, | ||
) | ||
local_path_override( | ||
module_name = "depend_on_what_you_use", | ||
path = "../../", | ||
) | ||
|
||
## | ||
## Python toolchains for testing compatibility to various Python versions | ||
## | ||
|
||
bazel_dep( | ||
name = "rules_python", | ||
version = "0.27.0", | ||
dev_dependency = True, | ||
) | ||
|
||
# Update with each rules_python update for easy lookup until specifying the patch version for toolchain is possible again | ||
# Keep in syc with execute_tests.py | ||
# PATCH_MAPPING: | ||
# "3.8": "3.8.18" | ||
# "3.9": "3.9.18" | ||
# "3.10": "3.10.13" | ||
# "3.11": "3.11.6" | ||
# "3.12": "3.12.0" | ||
# Choose different version via: --@rules_python//python/config_settings:python_version=Major.Minor.Patch mathing one of | ||
# the registered toolchains below. | ||
python = use_extension( | ||
"@rules_python//python/extensions:python.bzl", | ||
"python", | ||
dev_dependency = True, | ||
) | ||
python.toolchain( | ||
is_default = True, | ||
python_version = "3.8", | ||
) | ||
python.toolchain( | ||
python_version = "3.9", | ||
) | ||
python.toolchain( | ||
python_version = "3.10", | ||
) | ||
python.toolchain( | ||
python_version = "3.11", | ||
) | ||
python.toolchain( | ||
python_version = "3.12", | ||
) | ||
|
||
## | ||
## Workspaces for test purposes | ||
## | ||
|
||
bazel_dep( | ||
name = "external_test_repo", | ||
version = "0.0.0", | ||
dev_dependency = True, | ||
) | ||
local_path_override( | ||
module_name = "external_test_repo", | ||
path = "external_repo/repo", | ||
) | ||
|
||
bazel_dep( | ||
name = "complex_includes_test_repo", | ||
version = "0.0.0", | ||
dev_dependency = True, | ||
) | ||
local_path_override( | ||
module_name = "complex_includes_test_repo", | ||
path = "complex_includes/ext_repo", | ||
) | ||
|
||
## | ||
## The Migration phase using WORKSPACE.bzlmod and MODULE.bazel together does not support properly loading the implicit | ||
## Bazel dependencies. Thus, we need to load some basic things directly. This should become superfluous when we are | ||
## only using bzlmod eventually | ||
## Reference https://github.com/bazelbuild/bazel/blob/master/src/MODULE.tools | ||
## | ||
|
||
bazel_dep( | ||
name = "platforms", | ||
version = "0.0.7", | ||
dev_dependency = True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
workspace(name = "dwyu_aspect_integration_tests") | ||
|
||
local_repository( | ||
name = "depend_on_what_you_use", | ||
path = "../../", | ||
) | ||
|
||
load("@depend_on_what_you_use//:setup_step_1.bzl", "setup_step_1") | ||
|
||
setup_step_1() | ||
|
||
load("@depend_on_what_you_use//:setup_step_2.bzl", "setup_step_2") | ||
|
||
setup_step_2() | ||
|
||
## | ||
## Python toolchains for testing compatibility to various Python versions | ||
## | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
|
||
maybe( | ||
http_archive, | ||
name = "rules_python", | ||
sha256 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31", | ||
strip_prefix = "rules_python-0.27.0", | ||
urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.0.tar.gz"], | ||
) | ||
|
||
load("@rules_python//python:repositories.bzl", "python_register_multi_toolchains") | ||
|
||
# Choose different version via: --@rules_python//python/config_settings:python_version=X | ||
python_register_multi_toolchains( | ||
name = "python", | ||
default_version = "3.8", | ||
python_versions = [ | ||
"3.9", | ||
"3.10", | ||
"3.11", | ||
"3.12", | ||
], | ||
) | ||
|
||
## | ||
## Workspaces for test purposes | ||
## | ||
|
||
load("//complex_includes:ext_repo.bzl", "load_complex_includes_repo") | ||
load("//external_repo:repo.bzl", "load_external_repo") | ||
|
||
load_external_repo() | ||
|
||
load_complex_includes_repo() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#ifndef B_H | ||
#define B_H | ||
|
||
#include "test/aspect/alias/a.h" | ||
#include "alias/a.h" | ||
|
||
int doB() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
load("//:defs.bzl", "dwyu_aspect_factory") | ||
load("@depend_on_what_you_use//:defs.bzl", "dwyu_aspect_factory") | ||
|
||
dwyu = dwyu_aspect_factory() | ||
dwyu_impl_deps = dwyu_aspect_factory(use_implementation_deps = True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#ifdef SOME_DEFINE | ||
#include "test/aspect/defines/support/a.h" | ||
#include "defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif | ||
|
||
#ifdef LOCAL_DEFINE | ||
#include "test/aspect/defines/support/a.h" | ||
#include "defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif | ||
|
||
#if SOME_COPT > 40 | ||
#include "test/aspect/defines/support/a.h" | ||
#include "defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#define USE_A | ||
|
||
#ifdef USE_A | ||
#include "test/aspect/defines/support/a.h" | ||
#include "defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif | ||
|
||
#ifdef NON_EXISTING_DEFINE | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif | ||
|
||
#define SOME_VALUE 42 | ||
|
||
#if SOME_VALUE > 40 | ||
#include "test/aspect/defines/support/a.h" | ||
#include "defines/support/a.h" | ||
#else | ||
#include "test/aspect/defines/support/b.h" | ||
#include "defines/support/b.h" | ||
#endif |
Oops, something went wrong.