summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2023-04-29 21:09:44 +0200
committerFlorian Schmaus <flow@gentoo.org>2023-04-29 21:16:34 +0200
commit9c479450dfc4080bb682ac6803107efe2422b81c (patch)
tree29d9a5b44c28f331045ec8707513af9bceb7da2e
parentsys-kernel/vanilla-kernel: Remove old (diff)
downloadgentoo-9c479450dfc4080bb682ac6803107efe2422b81c.tar.gz
gentoo-9c479450dfc4080bb682ac6803107efe2422b81c.tar.bz2
gentoo-9c479450dfc4080bb682ac6803107efe2422b81c.zip
dev-util/include-what-you-use: fix tests
1. invoke run_iwyu_tests with "-- ${BUILD_DIR}/bin/${PN}", so that the just build iwyu is used and not the one potentially available in PATH 2. Fix include path, see https://github.com/include-what-you-use/include-what-you-use/pull/1252 3. Drop stddef from badinc.cc. This makes the test pass. I am not sure if this is correct or not, but at the moment it was either this or dropping the test entirely. Closes: https://bugs.gentoo.org/905214 Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r--dev-util/include-what-you-use/Manifest1
-rw-r--r--dev-util/include-what-you-use/files/include-what-you-use-0.19-tests-cxx-badinc.cc-remove-stddef-from-expected.patch34
-rw-r--r--dev-util/include-what-you-use/include-what-you-use-0.19.ebuild21
3 files changed, 54 insertions, 2 deletions
diff --git a/dev-util/include-what-you-use/Manifest b/dev-util/include-what-you-use/Manifest
index f5981ea17c80..70e10aaf4ba5 100644
--- a/dev-util/include-what-you-use/Manifest
+++ b/dev-util/include-what-you-use/Manifest
@@ -1 +1,2 @@
+DIST include-what-you-use-0.19-test-util-support-EXTRA_IWYU_ARGS.patch 2314 BLAKE2B d6c99aa59b52207ece610f8a8fe52ae967f3e027118c97f665b0a5d21782d85d94658ece1e0ae0e2d86cdcb94a345f072fdbda495caf589b045a8be38bf56f99 SHA512 2ecd6afc2de5ff85c8a6609b151d7d1e50a985e5c52db9b298ce21bad94a3bafb7b939fcd3b3cec0b753e83ba9ea256f628fbda16837ee6b3c3f1d2ec664d4d9
DIST include-what-you-use-0.19.tar.gz 757761 BLAKE2B 09dfe686db78973059039f878029cda8dea9912127cf7ed9ddc123abe14459e670304fd531760afbebedee8c4992d15add18b75f9b62dc2d9c4b0f4edb8e0a1d SHA512 0847ae898696b51540ab9f5715e69bae67db42409d60205227d543ba6597b12cc2ea5bf68a3315c31f22e7186e05c06a86f5ae5b893c23bfe4cd9ef6f06ccddc
diff --git a/dev-util/include-what-you-use/files/include-what-you-use-0.19-tests-cxx-badinc.cc-remove-stddef-from-expected.patch b/dev-util/include-what-you-use/files/include-what-you-use-0.19-tests-cxx-badinc.cc-remove-stddef-from-expected.patch
new file mode 100644
index 000000000000..4d63e0c1530a
--- /dev/null
+++ b/dev-util/include-what-you-use/files/include-what-you-use-0.19-tests-cxx-badinc.cc-remove-stddef-from-expected.patch
@@ -0,0 +1,34 @@
+From 0c4577fc5796b2824da5629f77bf6bf6bdcd4823 Mon Sep 17 00:00:00 2001
+From: Florian Schmaus <flo@geekplace.eu>
+Date: Sat, 29 Apr 2023 20:12:00 +0200
+Subject: [PATCH] tests/cxx/badinc.cc: remove stddef from expected output
+
+--- a/tests/cxx/badinc.cc
++++ b/tests/cxx/badinc.cc
+@@ -1415,7 +1415,6 @@ int main() {
+ typeof(kI1ConstInt) another_const_int = 1;
+ (void)(another_const_int);
+ // This is a C standard macro, but is implemented via a gcc extension too.
+- // IWYU: offsetof is...*<stddef.h>
+ // IWYU: I1_Struct is...*badinc-i1.h
+ (void)(offsetof(I1_Struct, c));
+ // IWYU: kI1ConstInt is...*badinc-i1.h
+@@ -1807,7 +1806,6 @@ int main() {
+
+ tests/cxx/badinc.cc should add these lines:
+ #include <ctype.h>
+-#include <stddef.h>
+ #include <list>
+ #include "tests/cxx/badinc-i1.h"
+ class D2_Class;
+@@ -1836,7 +1834,6 @@ The full include-list for tests/cxx/badinc.cc:
+ #include "tests/cxx/badinc-inl.h"
+ #include <ctype.h> // for isascii
+ #include <setjmp.h>
+-#include <stddef.h> // for offsetof
+ #include <algorithm> // for find
+ #include <fstream> // for fstream
+ #include <list> // for list
+--
+2.39.2
+
diff --git a/dev-util/include-what-you-use/include-what-you-use-0.19.ebuild b/dev-util/include-what-you-use/include-what-you-use-0.19.ebuild
index 367e7c6d5101..eb3c6a7e4c82 100644
--- a/dev-util/include-what-you-use/include-what-you-use-0.19.ebuild
+++ b/dev-util/include-what-you-use/include-what-you-use-0.19.ebuild
@@ -9,7 +9,11 @@ inherit cmake llvm python-single-r1
DESCRIPTION="Find unused include directives in C/C++ programs"
HOMEPAGE="https://include-what-you-use.org/"
-SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+SRC_URI="
+ https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+ https://github.com/include-what-you-use/include-what-you-use/commit/62e5e2e35380e46ccbff2c2ed118f8bb5c01755b.patch
+ -> ${PN}-0.19-test-util-support-EXTRA_IWYU_ARGS.patch
+"
LICENSE="GPL-2"
SLOT="0"
@@ -26,6 +30,12 @@ DEPEND="${RDEPEND}"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+PATCHES=(
+ # https://github.com/include-what-you-use/include-what-you-use/pull/1252
+ "${DISTDIR}"/${PN}-0.19-test-util-support-EXTRA_IWYU_ARGS.patch
+ "${FILESDIR}"/${PN}-0.19-tests-cxx-badinc.cc-remove-stddef-from-expected.patch
+)
+
llvm_check_deps() {
has_version "sys-devel/clang:${LLVM_SLOT}"
}
@@ -54,5 +64,12 @@ src_configure() {
}
src_test() {
- "${EPYTHON}" run_iwyu_tests.py || die
+ local clang_version=$(best_version sys-devel/clang:${LLVM_MAX_SLOT})
+ clang_version=${clang_version#*/*-} # reduce it to ${PV}-${PR}
+ clang_version=${clang_version%%[_-]*} # main version without beta/pre/patch/revision
+
+ local -x EXTRA_IWYU_ARGS="-I ${ESYSROOT}/usr/lib/clang/${clang_version}/include"
+ "${EPYTHON}" run_iwyu_tests.py \
+ -- "${BUILD_DIR}"/bin/${PN} \
+ || die "Tests failed with $? (using ${EPYTHON})"
}