-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antlir2][toolchain] easy test generation for deps tests
Summary: While it appears that we can link against `rpm_library` targets that have (but do not express) transitive dependencies, dependencies often still need to be correctly expressed for header `#include`s to work. This diff adds a simple way to define a test binary that will only compile if certain header files are able to be `#include`d. By default, no headers are included, but the binary will not launch if dependencies are not correctly specified. Test Plan: ``` ❯ buck uquery 'attrfilter(labels, antlir-distro-dep-test, fbcode//antlir/distro/deps/...)' | xargs buck test --target-platforms fbcode//antlir/distro/platform:centos9-x86_64 Buck UI: https://www.internalfb.com/buck2/29f47e8d-ebc9-4ce4-afcf-c0937666287a Test UI: https://www.internalfb.com/intern/testinfra/testrun/12384899041396371 Tests finished: Pass 42. Fail 0. Fatal 0. Skip 0. Build failure 0 ``` Perhaps more importantly, it fails when incorrect ``` ❯ hg diff diff --git a/fbcode/antlir/distro/deps/glog/BUCK b/fbcode/antlir/distro/deps/glog/BUCK --- a/fbcode/antlir/distro/deps/glog/BUCK +++ b/fbcode/antlir/distro/deps/glog/BUCK @@ -5,10 +5,10 @@ rpm_library( name = "glog", test_include_headers = [ - "glog/logging.h", + # "glog/logging.h", ], visibility = ["PUBLIC"], exported_deps = [ - "//antlir/distro/deps/gflags:gflags", + # "//antlir/distro/deps/gflags:gflags", ], ) ❯ buck2 test --target-platforms fbcode//antlir/distro/platform:centos9-x86_64 fbcode//antlir/distro/deps/glog: fbcode//antlir/distro/deps/jsoncpp: ✗ Fail: antlir/distro/deps/glog:glog--test-deps - main (0.0s) Test returned with non-zero exit code stdout: stderr: /data/users/vmagro/fbsource/buck-out/v2/gen/fbcode/6700a0e98152df5f/antlir/distro/deps/glog/__glog--test-deps-binary__/glog--test-deps-binary: error while loading shared libraries: libgflags.so.2.2: cannot open shared object file: No such file or directory Buck UI: https://www.internalfb.com/buck2/27a0f966-73b6-4adf-8b0d-0dd29bea5bfc Network: Up: 0B Down: 0B Command: test. Time elapsed: 2.3s Tests finished: Pass 3. Fail 1. Fatal 0. Skip 0. Build failure 0 1 TESTS FAILED ✗ antlir/distro/deps/glog:glog--test-deps - main ``` Reviewed By: epilatow Differential Revision: D68785473 fbshipit-source-id: 739eccc7c5fb86e996c7d3d7387d144900d25b79
- Loading branch information
1 parent
5f0ec0d
commit 99336d6
Showing
10 changed files
with
71 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("//antlir/distro/deps:rpm_library.bzl", "rpm_library") | ||
|
||
oncall("antlir") | ||
|
||
rpm_library( | ||
name = "gtest", | ||
visibility = ["PUBLIC"], | ||
) |
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,9 @@ | ||
load("//antlir/distro/deps:rpm_library.bzl", "rpm_library") | ||
|
||
oncall("antlir") | ||
|
||
rpm_library( | ||
name = "unwind", | ||
rpm = "libunwind-devel", | ||
visibility = ["PUBLIC"], | ||
) |
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ rpm_library( | |
name = "pcrecpp", | ||
rpm = "pcre-devel", | ||
visibility = ["PUBLIC"], | ||
exported_deps = [":pcre"], | ||
) |
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