Skip to content

Commit fe9b4b2

Browse files
committed
nix: add building oid to the flake
OI's build is challenging and has often been a problem for the Open Source community. It requires an extremely specific set of dependencies that are very hard to achieve on most systems. There are frequent breakages, like when updating to CentOS Stream 9, or when trying to update the CI's clang from clang-12 to clang-15 - OI requires the clang libraries to be version 15 but can't be compiled with it on the CI! This changes provides a mostly working build environment with `nix`. This environment is pinned to a specific nixpkgs revision using `flake.lock`, and only updates when we explicitly tell it to. Summary of changes: - Update CMakeLists.txt required version to 3.24. This allows specifying `FIND_PACKAGE_ARGS` in `FetchContent`, meaning we can use system packages. This is available on most up to date distros (3.30.2 is current). - Extends `flake.nix` to be able to build OI. Adds instructions for building and developing OI using `nix`. - Partially runs the tests in GitHub Actions. A huge amount must be excluded because of incompatibilites between the clangStdenv compiler and drgn. We have similar, though fewer, issues when building with the clang-12/libstdcxx mix on the Ubuntu 22.04 CircleCI, though this is at least reproducible. - Updates CircleCI to build CMake from source as we don't have a newer image available. Also add some newly found dependencies (not sure how it was working without them before). Test plan: This change requires less testing than previous build related changes because it deprecates most of the build types. - The internal BUCK build is unaffected. No special testing. - The semi-internal CMake build is gone. Use Nix. - The Nix build for clang-15 and some tests are continuously tested in GitHub actions. - Tested the set of Nix commands in the README. All work except the one that points to GitHub as this must be merged first. - The existing CircleCI runs on Ubuntu 20.04 are maintained. - Unable to test the new `test-report.yml` as it must be merged due to the permissions it needs. Will follow up with testing after this is merged. See: https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories The list of exclusions for GitHub Actions/nix testing is currently very long, I think 29% of the tests. This should be stable and reproducible though, and likely needs deep changes to OI to fix. That's why fixes are excluded from this PR. It's all to do with the forked drgn not being able to parse clang's newer DWARF output, and can't be fixed by rolling back as we required a relatively new libcxx.
1 parent e161d31 commit fe9b4b2

File tree

12 files changed

+639
-129
lines changed

12 files changed

+639
-129
lines changed

.circleci/config.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,26 @@ jobs:
8383
libgtest-dev \
8484
libjemalloc-dev \
8585
libmsgpack-dev \
86+
libomp-12-dev \
87+
liburing-dev \
8688
libzstd-dev \
8789
llvm-15-dev \
8890
ninja-build \
8991
pkg-config \
9092
python3-setuptools
9193
pip3 install toml
94+
95+
# Ubuntu 22.04 CMake is too old and we don't have a newer image yet
96+
git clone --depth 1 --branch v3.30.2 https://github.com/Kitware/CMake.git /tmp/cmake
97+
(cd /tmp/cmake && cmake -B build/ -G Ninja && cmake --build build/)
9298
environment:
9399
DEBIAN_FRONTEND: noninteractive
94100
- checkout
95101
- run:
96102
name: Build
97103
command: |
98-
cmake -G Ninja -B build/ -DWITH_FLAKY_TESTS=Off -DCODE_COVERAGE=On -DWARNINGS_AS_ERRORS=<< parameters.warnings_as_errors >>
99-
cmake --build build/
104+
/tmp/cmake/build/bin/cmake -G Ninja -B build/ -DWITH_FLAKY_TESTS=Off -DCODE_COVERAGE=On -DWARNINGS_AS_ERRORS=<< parameters.warnings_as_errors >>
105+
ninja -C build/
100106
# Testing rubbish:
101107
cp test/ci.oid.toml build/testing.oid.toml
102108
- persist_to_workspace:
@@ -131,10 +137,12 @@ jobs:
131137
sudo apt-get install -y \
132138
clang-15 \
133139
libboost-all-dev \
134-
libgflags-dev \
135-
llvm-15-dev \
136140
libfmt-dev \
137-
libjemalloc-dev
141+
libgflags-dev \
142+
libgoogle-glog-dev \
143+
libjemalloc-dev \
144+
libomp-12-dev \
145+
llvm-15-dev
138146
environment:
139147
DEBIAN_FRONTEND: noninteractive
140148
- run:

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/[email protected]
9+
- uses: cachix/install-nix-action@v27
10+
with:
11+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
12+
- name: nix fmt
13+
run: |-
14+
nix --experimental-features 'nix-command flakes' fmt
15+
git diff --exit-code
16+
17+
build-test:
18+
runs-on: 16-core-ubuntu
19+
strategy:
20+
matrix:
21+
llvm_version: [15]
22+
steps:
23+
- uses: actions/[email protected]
24+
- uses: cachix/install-nix-action@v27
25+
with:
26+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
27+
- name: build (LLVM ${{ matrix.llvm_version }})
28+
# Run the build manually in `nix develop` to keep non-outputs around
29+
run: |
30+
nix develop .#oid-llvm${{ matrix.llvm_version }} --command cmake -B build -G Ninja -DWITH_FLAKY_TESTS=Off -DFORCE_BOOST_STATIC=Off
31+
nix develop .#oid-llvm${{ matrix.llvm_version }} --command ninja -C build
32+
- name: test (LLVM ${{ matrix.llvm_version }})
33+
env:
34+
# disable drgn multithreading as tests are already run in parallel
35+
OMP_NUM_THREADS: 1
36+
run: |
37+
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
38+
nix develop .#oid-llvm${{ matrix.llvm_version }} --command ./tools/config_gen.py -c clang++ build/testing.oid.toml
39+
nix develop .#oid-llvm${{ matrix.llvm_version }} --command ctest \
40+
--test-dir build/test/ \
41+
--test-action Test \
42+
--parallel \
43+
--no-compress-output \
44+
--schedule-random \
45+
--timeout 90 \
46+
--repeat until-pass:3 \
47+
--exclude-from-file ../../.github/workflows/tests_failing_under_nix.txt \
48+
--output-junit results.xml
49+
- name: upload results
50+
uses: actions/upload-artifact@v4
51+
if: success() || failure()
52+
with:
53+
name: test-results-${{ matrix.llvm_version }}
54+
path: build/test/results.xml

.github/workflows/object-introspection.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/test-report.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Test Report'
2+
on:
3+
workflow_run:
4+
workflows: ['CI']
5+
types:
6+
- completed
7+
permissions:
8+
contents: read
9+
actions: read
10+
checks: write
11+
jobs:
12+
report:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: dorny/test-reporter@v1
16+
with:
17+
artifact: test-results-15
18+
name: CTest Tests
19+
path: results.xml
20+
reporter: jest-junit
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
AddChildrenTest.InheritancePolymorphic
2+
ClangTypeParserTest.MemberAlignment
3+
ClangTypeParserTest.SimpleStruct
4+
DrgnParserTest.ClassTemplateInt
5+
DrgnParserTest.Container
6+
DrgnParserTest.TemplateEnumValue
7+
DrgnParserTest.TemplateEnumValueGaps
8+
DrgnParserTest.TemplateEnumValueNegative
9+
OidIntegration.alignment_wrapper_member_alignment
10+
OidIntegration.alignment_wrapper_member_lower
11+
OidIntegration.alignment_wrapper_member_override
12+
OidIntegration.alignment_wrapper_struct
13+
OidIntegration.alignment_wrapper_two_members
14+
OidIntegration.alignment_wrapper_union_member
15+
OidIntegration.anonymous_anon_struct
16+
OidIntegration.anonymous_anon_typedef
17+
OidIntegration.anonymous_anon_union
18+
OidIntegration.anonymous_nested_anon_struct
19+
OidIntegration.anonymous_regular_struct
20+
OidIntegration.arrays_member_int0
21+
OidIntegration.arrays_member_int10
22+
OidIntegration.arrays_multidim
23+
OidIntegration.arrays_multidim_legacy
24+
OidIntegration.bitfields_enum
25+
OidIntegration.bitfields_mixed
26+
OidIntegration.bitfields_single
27+
OidIntegration.bitfields_straddle_bytes
28+
OidIntegration.bitfields_within_bytes
29+
OidIntegration.bitfields_zero_bits
30+
OidIntegration.cycles_raw_ptr
31+
OidIntegration.cycles_raw_ptr_wrapped
32+
OidIntegration.cycles_shared_ptr
33+
OidIntegration.cycles_unique_ptr
34+
OidIntegration.enums_params_scoped_enum_val
35+
OidIntegration.enums_params_scoped_enum_val_cast
36+
OidIntegration.enums_params_scoped_enum_val_gaps
37+
OidIntegration.enums_params_scoped_enum_val_negative
38+
OidIntegration.enums_params_unscoped_enum_val_cast
39+
OidIntegration.fbstring_empty
40+
OidIntegration.fbstring_heap_allocated
41+
OidIntegration.fbstring_inline
42+
OidIntegration.fbstring_string_pooled_unique
43+
OidIntegration.folly_f14_fast_map_a
44+
OidIntegration.folly_f14_fast_set_a
45+
OidIntegration.folly_f14_node_map_a
46+
OidIntegration.folly_f14_node_set_a
47+
OidIntegration.folly_f14_value_map_a
48+
OidIntegration.folly_f14_value_set_a
49+
OidIntegration.folly_f14_vector_map_a
50+
OidIntegration.folly_f14_vector_set_a
51+
OidIntegration.folly_small_vector_int_always_heap
52+
OidIntegration.folly_small_vector_int_default_empty
53+
OidIntegration.folly_small_vector_int_default_inlined
54+
OidIntegration.folly_small_vector_int_default_overflow
55+
OidIntegration.folly_small_vector_vector_3_empty
56+
OidIntegration.folly_small_vector_vector_3_inlined
57+
OidIntegration.folly_small_vector_vector_3_overflow
58+
OidIntegration.folly_sorted_vector_map_int_int_empty
59+
OidIntegration.folly_sorted_vector_map_int_int_reserve
60+
OidIntegration.folly_sorted_vector_map_int_int_some
61+
OidIntegration.ignored_member
62+
OidIntegration.ignored_roottype
63+
OidIntegration.ignored_subtype
64+
OidIntegration.inheritance_access_private
65+
OidIntegration.inheritance_access_protected
66+
OidIntegration.inheritance_access_public
67+
OidIntegration.inheritance_access_public_as_base
68+
OidIntegration.inheritance_multiple_a
69+
OidIntegration.inheritance_polymorphic_a_as_a
70+
OidIntegration.inheritance_polymorphic_b_as_a
71+
OidIntegration.inheritance_polymorphic_b_as_b
72+
OidIntegration.inheritance_polymorphic_c_as_a
73+
OidIntegration.inheritance_polymorphic_c_as_b
74+
OidIntegration.inheritance_polymorphic_c_as_c
75+
OidIntegration.inheritance_polymorphic_diamond_child_as_child
76+
OidIntegration.inheritance_polymorphic_diamond_child_as_middle1
77+
OidIntegration.inheritance_polymorphic_diamond_child_as_middle1_root
78+
OidIntegration.inheritance_polymorphic_diamond_child_as_middle2
79+
OidIntegration.inheritance_polymorphic_diamond_child_as_middle2_root
80+
OidIntegration.inheritance_polymorphic_diamond_middle1_as_middle1
81+
OidIntegration.inheritance_polymorphic_diamond_middle1_as_root
82+
OidIntegration.inheritance_polymorphic_diamond_middle2_as_middle2
83+
OidIntegration.inheritance_polymorphic_diamond_middle2_as_root
84+
OidIntegration.inheritance_polymorphic_diamond_root_as_root
85+
OidIntegration.inheritance_polymorphic_non_dynamic_base_a_as_a
86+
OidIntegration.inheritance_polymorphic_non_dynamic_base_a_no_polymorphic
87+
OidIntegration.inheritance_polymorphic_non_dynamic_base_b_as_a
88+
OidIntegration.inheritance_polymorphic_non_dynamic_base_b_as_b
89+
OidIntegration.inheritance_polymorphic_non_dynamic_base_b_no_polymorphic
90+
OidIntegration.inheritance_polymorphic_non_dynamic_base_c_as_a
91+
OidIntegration.inheritance_polymorphic_non_dynamic_base_c_as_b
92+
OidIntegration.inheritance_polymorphic_non_dynamic_base_c_as_c
93+
OidIntegration.inheritance_polymorphic_non_dynamic_base_c_no_polymorphic
94+
OidIntegration.multi_arg_tb_all_fail_crashes
95+
OidIntegration.multi_arg_tb_fail_first_arg
96+
OidIntegration.namespaces_queue
97+
OidIntegration.namespaces_stack
98+
OidIntegration.packed_a
99+
OidIntegration.padding_bool_padding
100+
OidIntegration.padding_nested_padding
101+
OidIntegration.pointers_feature_config
102+
OidIntegration.pointers_feature_flag_disabled
103+
OidIntegration.pointers_incomplete_containing_struct
104+
OidIntegration.pointers_incomplete_containing_struct_no_follow
105+
OidIntegration.pointers_incomplete_shared_ptr
106+
OidIntegration.pointers_incomplete_shared_ptr_null
107+
OidIntegration.pointers_incomplete_unique_ptr
108+
OidIntegration.pointers_incomplete_unique_ptr_null
109+
OidIntegration.pointers_struct_primitive_ptrs
110+
OidIntegration.pointers_struct_primitive_ptrs_no_follow
111+
OidIntegration.pointers_struct_primitive_ptrs_null
112+
OidIntegration.pointers_struct_vector_ptr
113+
OidIntegration.pointers_struct_vector_ptr_no_follow
114+
OidIntegration.pointers_struct_vector_ptr_null
115+
OidIntegration.pointers_vector_of_pointers
116+
OidIntegration.primitives_long_double
117+
OidIntegration.simple_class
118+
OidIntegration.simple_struct
119+
OidIntegration.simple_union
120+
OidIntegration.sorted_vector_set_no_ints
121+
OidIntegration.sorted_vector_set_some_ints
122+
OidIntegration.std_array_uint64_length_0
123+
OidIntegration.std_array_uint64_length_1
124+
OidIntegration.std_array_uint64_length_8
125+
OidIntegration.std_array_vector_length_1
126+
OidIntegration.std_array_vector_length_2
127+
OidIntegration.std_conditional_a
128+
OidIntegration.std_deque_del_allocator_a
129+
OidIntegration.std_deque_deque_int_empty
130+
OidIntegration.std_deque_deque_int_some
131+
OidIntegration.std_deque_int_empty
132+
OidIntegration.std_deque_int_some
133+
OidIntegration.std_list_del_allocator_a
134+
OidIntegration.std_list_int_empty
135+
OidIntegration.std_list_int_some
136+
OidIntegration.std_list_list_int_empty
137+
OidIntegration.std_list_list_int_some
138+
OidIntegration.std_list_struct_some
139+
OidIntegration.std_map_custom_comparator_a
140+
OidIntegration.std_multimap_custom_comparator_a
141+
OidIntegration.std_multiset_custom_comparator_a
142+
OidIntegration.std_optional_uint64_empty
143+
OidIntegration.std_optional_uint64_present
144+
OidIntegration.std_optional_vector_empty
145+
OidIntegration.std_optional_vector_present
146+
OidIntegration.std_pair_uint64_uint32
147+
OidIntegration.std_pair_uint64_uint64
148+
OidIntegration.std_pair_vector_vector
149+
OidIntegration.std_priority_queue_adapter_deque_empty
150+
OidIntegration.std_priority_queue_adapter_deque_some
151+
OidIntegration.std_priority_queue_int_empty
152+
OidIntegration.std_priority_queue_int_some
153+
OidIntegration.std_queue_adapter_vector_empty
154+
OidIntegration.std_queue_adapter_vector_some
155+
OidIntegration.std_queue_int_empty
156+
OidIntegration.std_queue_int_some
157+
OidIntegration.std_queue_queue_int_empty
158+
OidIntegration.std_queue_queue_int_some
159+
OidIntegration.std_reference_wrapper_int
160+
OidIntegration.std_reference_wrapper_vector
161+
OidIntegration.std_set_custom_comparator_a
162+
OidIntegration.std_smart_ptr_shared_ptr_const_uint64_empty
163+
OidIntegration.std_smart_ptr_shared_ptr_const_vector_empty
164+
OidIntegration.std_smart_ptr_shared_ptr_uint64_empty
165+
OidIntegration.std_smart_ptr_shared_ptr_uint64_present
166+
OidIntegration.std_smart_ptr_shared_ptr_vector_empty
167+
OidIntegration.std_smart_ptr_shared_ptr_vector_present
168+
OidIntegration.std_smart_ptr_shared_ptr_void_empty
169+
OidIntegration.std_smart_ptr_shared_ptr_void_present
170+
OidIntegration.std_smart_ptr_unique_ptr_const_uint64_empty
171+
OidIntegration.std_smart_ptr_unique_ptr_const_vector_empty
172+
OidIntegration.std_smart_ptr_unique_ptr_uint64_empty
173+
OidIntegration.std_smart_ptr_unique_ptr_uint64_present
174+
OidIntegration.std_smart_ptr_unique_ptr_vector_empty
175+
OidIntegration.std_smart_ptr_unique_ptr_vector_present
176+
OidIntegration.std_smart_ptr_unique_ptr_void_empty
177+
OidIntegration.std_smart_ptr_unique_ptr_void_present
178+
OidIntegration.std_smart_ptr_weak_ptr_int64_empty
179+
OidIntegration.std_smart_ptr_weak_ptr_int64_expired
180+
OidIntegration.std_smart_ptr_weak_ptr_int64_expired_chase
181+
OidIntegration.std_smart_ptr_weak_ptr_int64_present
182+
OidIntegration.std_smart_ptr_weak_ptr_int64_present_chase
183+
OidIntegration.std_smart_ptr_weak_ptr_int64_void_empty
184+
OidIntegration.std_stack_adapter_vector_empty
185+
OidIntegration.std_stack_adapter_vector_some
186+
OidIntegration.std_stack_int_empty
187+
OidIntegration.std_stack_int_some
188+
OidIntegration.std_stack_stack_int_empty
189+
OidIntegration.std_stack_stack_int_some
190+
OidIntegration.std_string_empty
191+
OidIntegration.std_string_heap_allocated
192+
OidIntegration.std_string_sso
193+
OidIntegration.std_tuple_uint64_uint64
194+
OidIntegration.std_unordered_map_custom_operator_a
195+
OidIntegration.std_unordered_multimap_custom_operator_a
196+
OidIntegration.std_unordered_multiset_custom_operator_a
197+
OidIntegration.std_unordered_set_custom_operator_a
198+
OidIntegration.std_variant_256_params_256
199+
OidIntegration.std_variant_256_params_empty
200+
OidIntegration.std_variant_char_int64_1
201+
OidIntegration.std_variant_char_int64_2
202+
OidIntegration.std_variant_empty
203+
OidIntegration.std_variant_optional
204+
OidIntegration.std_variant_vector_int_1
205+
OidIntegration.std_variant_vector_int_2
206+
OidIntegration.std_vector_del_allocator_a
207+
OidIntegration.std_vector_int_empty
208+
OidIntegration.std_vector_int_some
209+
OidIntegration.std_vector_reserve
210+
OidIntegration.std_vector_struct_some
211+
OidIntegration.std_vector_vector_int_empty
212+
OidIntegration.std_vector_vector_int_some
213+
OidIntegration.templates_int
214+
OidIntegration.templates_two
215+
OidIntegration.templates_value
216+
OidIntegration.templates_vector
217+
OidIntegration.typedefed_parent_multilevel_typedef_parent
218+
OidIntegration.typedefed_parent_simple_typedef_parent
219+
OidIntegration.typedefs_anonymous
220+
OidIntegration.typedefs_container
221+
OidIntegration.unions_alignment
222+
OidIntegration.unions_int
223+
OidIntegration.unions_tagged_int
224+
OidIntegration.unions_tagged_unordered_map
225+
OidIntegration.unions_tagged_vector
226+
OidIntegration.unions_unordered_map
227+
OidIntegration.unions_vector
228+
OilIntegration.folly_f14_fast_map_a
229+
OilIntegration.folly_f14_fast_set_a
230+
OilIntegration.folly_f14_node_map_a
231+
OilIntegration.folly_f14_node_set_a
232+
OilIntegration.folly_f14_value_map_a
233+
OilIntegration.folly_f14_value_set_a
234+
OilIntegration.folly_f14_vector_map_a
235+
OilIntegration.folly_f14_vector_set_a

0 commit comments

Comments
 (0)