Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- ....c-patch-out-tests-that-require-a-wo.patch | 37 +++++++++ ...ncrease-default-timeval-tolerance-50.patch | 33 ++++++++ ...-monotonic_prc_fallback-as-retriable.patch | 28 +++++++ ...ts-are-marked-failed-only-when-all-a.patch | 81 +++++++++++++++++++ .../files/Makefile-missing-test-dir.patch | 27 +++++++ recipes-support/libevent/files/run-ptest | 29 +++++++ .../libevent/libevent-morello_2.1.12.bb | 64 +++++++++++++++ 7 files changed, 299 insertions(+) create mode 100644 recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch create mode 100644 recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch create mode 100644 recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch create mode 100644 recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch create mode 100644 recipes-support/libevent/files/Makefile-missing-test-dir.patch create mode 100644 recipes-support/libevent/files/run-ptest create mode 100644 recipes-support/libevent/libevent-morello_2.1.12.bb
diff --git a/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch b/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch new file mode 100644 index 0000000..505153d --- /dev/null +++ b/recipes-support/libevent/files/0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch @@ -0,0 +1,37 @@ +From 7c17967b8fd2d18b74a8934fd9bb8212ebd6a271 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Thu, 9 Jan 2020 13:22:46 +0100 +Subject: [PATCH] test/regress_dns.c: patch out tests that require a working + DNS + +This is not guaranteed for ptests under qemu, and in the absence +of a DNS that can reach to the internet, these tests fail. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com +--- + test/regress_dns.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/test/regress_dns.c b/test/regress_dns.c +index d2084b7..a1a8f3b 100644 +--- a/test/regress_dns.c ++++ b/test/regress_dns.c +@@ -2394,8 +2394,6 @@ struct testcase_t dns_testcases[] = { + { "reissue_disable_when_inactive", dns_reissue_disable_when_inactive_test, + TT_FORK|TT_NEED_BASE|TT_NO_LOGS, &basic_setup, NULL }, + { "inflight", dns_inflight_test, TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, +- { "bufferevent_connect_hostname", test_bufferevent_connect_hostname, +- TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, + #ifdef EVENT__HAVE_SETRLIMIT + { "bufferevent_connect_hostname_emfile", test_bufferevent_connect_hostname, + TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"emfile" }, +@@ -2405,8 +2403,6 @@ struct testcase_t dns_testcases[] = { + { "disable_when_inactive_no_ns", dns_disable_when_inactive_no_ns_test, + TT_FORK|TT_NEED_BASE|TT_NO_LOGS, &basic_setup, NULL }, + +- { "initialize_nameservers", dns_initialize_nameservers_test, +- TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, + #ifndef _WIN32 + { "nameservers_no_default", dns_nameservers_no_default_test, + TT_FORK|TT_NEED_BASE, &basic_setup, NULL }, diff --git a/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch b/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch new file mode 100644 index 0000000..0b20eda --- /dev/null +++ b/recipes-support/libevent/files/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch @@ -0,0 +1,33 @@ +From dff8fd27edb23bc1486809186c6a4fe1f75f2179 Mon Sep 17 00:00:00 2001 +From: Yi Fan Yu yifan.yu@windriver.com +Date: Thu, 22 Apr 2021 22:35:59 -0400 +Subject: [PATCH] test/regress.h: Increase default timeval tolerance 50 ms -> + 100 ms + +The default timeout tolerance is 50 ms, +which causes intermittent failure in many the +related tests in arm64 QEMU. + +See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14163 +(The root cause seems to be a heavy load) + +Upstream-Status: Submitted [https://github.com/libevent/libevent/pull/1157] + +Signed-off-by: Yi Fan Yu yifan.yu@windriver.com +--- + test/regress.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/regress.h b/test/regress.h +index f06a7669..829af4a7 100644 +--- a/test/regress.h ++++ b/test/regress.h +@@ -127,7 +127,7 @@ int test_ai_eq_(const struct evutil_addrinfo *ai, const char *sockaddr_port, + tt_int_op(labs(timeval_msec_diff((tv1), (tv2)) - diff), <=, tolerance) + + #define test_timeval_diff_eq(tv1, tv2, diff) \ +- test_timeval_diff_leq((tv1), (tv2), (diff), 50) ++ test_timeval_diff_leq((tv1), (tv2), (diff), 100) + + long timeval_msec_diff(const struct timeval *start, const struct timeval *end); + diff --git a/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch b/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch new file mode 100644 index 0000000..ddc19c4 --- /dev/null +++ b/recipes-support/libevent/files/0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch @@ -0,0 +1,28 @@ +From d01a57a998798da977c470f3b8d6a457c1adb144 Mon Sep 17 00:00:00 2001 +From: Azat Khuzhin azat@libevent.org +Date: Sun, 19 Sep 2021 00:57:31 +0300 +Subject: [PATCH] test: mark util/monotonic_prc_fallback as retriable + +Refs: #1193 + +Upstream-Status: Backport +--- + test/regress_util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/regress_util.c b/test/regress_util.c +index 45caa2700a40..a9e80db20149 100644 +--- a/test/regress_util.c ++++ b/test/regress_util.c +@@ -1672,7 +1672,7 @@ struct testcase_t util_testcases[] = { + { "monotonic_res_fallback", test_evutil_monotonic_res, TT_OFF_BY_DEFAULT, &basic_setup, (void*)"fallback" }, + { "monotonic_prc", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"" }, + { "monotonic_prc_precise", test_evutil_monotonic_prc, TT_RETRIABLE, &basic_setup, (void*)"precise" }, +- { "monotonic_prc_fallback", test_evutil_monotonic_prc, 0, &basic_setup, (void*)"fallback" }, ++ { "monotonic_prc_fallback", test_evutil_monotonic_prc, TT_RETRIABLE, &basic_setup, (void*)"fallback" }, + { "date_rfc1123", test_evutil_date_rfc1123, 0, NULL, NULL }, + { "evutil_v4addr_is_local", test_evutil_v4addr_is_local, 0, NULL, NULL }, + { "evutil_v6addr_is_local", test_evutil_v6addr_is_local, 0, NULL, NULL }, +-- +2.31.1 + diff --git a/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch b/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch new file mode 100644 index 0000000..ea17e87 --- /dev/null +++ b/recipes-support/libevent/files/0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch @@ -0,0 +1,81 @@ +From 36ebd92fa53c0097f1e2f9ec5aa5b5c6ec1b411d Mon Sep 17 00:00:00 2001 +From: Thomas Perrot thomas.perrot@bootlin.com +Date: Wed, 29 Sep 2021 13:50:35 +0200 +Subject: [PATCH] test: retriable tests are marked failed only when all + attempts have failed + +Fixes: #1193 + +Upstream-Status: Accepted + +Signed-off-by: Thomas Perrot thomas.perrot@bootlin.com +--- + test/tinytest.c | 13 ++++++------- + test/tinytest.h | 2 +- + 2 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/test/tinytest.c b/test/tinytest.c +index 85dfe74a720e..bf2882418eb6 100644 +--- a/test/tinytest.c ++++ b/test/tinytest.c +@@ -310,7 +310,8 @@ testcase_run_forked_(const struct testgroup_t *group, + + int + testcase_run_one(const struct testgroup_t *group, +- const struct testcase_t *testcase) ++ const struct testcase_t *testcase, ++ const int test_attempts) + { + enum outcome outcome; + +@@ -348,7 +349,7 @@ testcase_run_one(const struct testgroup_t *group, + if (opt_verbosity>0 && !opt_forked) + puts("SKIPPED"); + } else { +- if (!opt_forked) ++ if (!opt_forked && (testcase->flags & TT_RETRIABLE) && !test_attempts) + printf("\n [%s FAILED]\n", testcase->name); + } + +@@ -525,22 +526,20 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups) + struct testgroup_t *group = &groups[i]; + for (j = 0; group->cases[j].name; ++j) { + struct testcase_t *testcase = &group->cases[j]; +- int test_attempts = 3; ++ int test_attempts = (testcase->flags & TT_RETRIABLE) ? 3: 1; + int test_ret_err; + + if (!(testcase->flags & TT_ENABLED_)) + continue; + + for (;;) { +- test_ret_err = testcase_run_one(group, testcase); ++ test_ret_err = testcase_run_one(group, testcase, test_attempts); + + if (test_ret_err == OK) + break; +- if (!(testcase->flags & TT_RETRIABLE)) ++ if (!--test_attempts) + break; + printf("\n [RETRYING %s (%i)]\n", testcase->name, test_attempts); +- if (!test_attempts--) +- break; + } + + switch (test_ret_err) { +diff --git a/test/tinytest.h b/test/tinytest.h +index d321dd467542..c276b5339331 100644 +--- a/test/tinytest.h ++++ b/test/tinytest.h +@@ -92,7 +92,7 @@ char *tinytest_format_hex_(const void *, unsigned long); + tinytest_set_flag_(groups, named, 1, TT_SKIP) + + /** Run a single testcase in a single group. */ +-int testcase_run_one(const struct testgroup_t *,const struct testcase_t *); ++int testcase_run_one(const struct testgroup_t *,const struct testcase_t *, const int test_attempts); + + void tinytest_set_aliases(const struct testlist_alias_t *aliases); + +-- +2.31.1 + diff --git a/recipes-support/libevent/files/Makefile-missing-test-dir.patch b/recipes-support/libevent/files/Makefile-missing-test-dir.patch new file mode 100644 index 0000000..8880bd0 --- /dev/null +++ b/recipes-support/libevent/files/Makefile-missing-test-dir.patch @@ -0,0 +1,27 @@ +Fix missing test directory creation. + +GCC used in OE-core has "dependency tracking" disabled and +libevent has problem with this. +Due to removed makefile.am/in files in test/sample/include +directories, output directories are not created in +configuration step. Compilation step will fails, when +trying to write to non-existing directory. + +Upstream-Status: Inappropriate [Other] +Workaround specific to our build system. + +Signed-off-by: Andrej Valek andrej.valek@siemens.com +Signed-off-by: Pascal Bach pascal.bach@siemens.com + +diff --git a/libevent-2.1.8-stable/test/include.am b/libevent-2.1.8-stable/test/include.am +index eea249f..d323dff 100644 +--- a/test/include.am ++++ b/test/include.am +@@ -161,6 +161,7 @@ test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la + test/regress.gen.c test/regress.gen.h: test/rpcgen-attempted + + test/rpcgen-attempted: test/regress.rpc event_rpcgen.py test/rpcgen_wrapper.sh ++ @$(MKDIR_P) test + $(AM_V_GEN)date -u > $@ + $(AM_V_at)if $(srcdir)/test/rpcgen_wrapper.sh $(srcdir)/test; then \ + true; \ diff --git a/recipes-support/libevent/files/run-ptest b/recipes-support/libevent/files/run-ptest new file mode 100644 index 0000000..ef4260d --- /dev/null +++ b/recipes-support/libevent/files/run-ptest @@ -0,0 +1,29 @@ +#!/bin/sh + +# run-ptest - 'ptest' test infrastructure shell script that +# wraps the libevent test scripts +# +# Trevor Gamblin trevor.gamblin@windriver.com +############################################################### +LIBEVENTLIB=@libdir@/libevent +LOG="${LIBEVENTLIB}/ptest/libevent_ptest_$(date +%Y%m%d-%H%M%S).log" + +cd ${LIBEVENTLIB}/ptest + +# Run only the libevent "regress" test. All other test scripts in the +# libevent "test" folder are related to performance, e.g. read/write +# rates, and/or do not provide a pass/fail output that can be recorded +# in the ptest log. +./test/regress 2>&1| sed -e '/TESTS/d' -e '/tests/d' -e '/OK/ s/^/PASS: / ; /FAILED/ s/^/FAIL: / ; /SKIPPED/ s/^/SKIP: / ; /DISABLED/ s/^/SKIP: /' | cut -f1,2 -d ':' | tee -a ${LOG} + +passed=`grep PASS: ${LOG}|wc -l` +failed=`grep FAIL: ${LOG}|wc -l` +skipped=`grep -E SKIP: ${LOG}|wc -l` +all=$((passed + failed + skipped)) + +( echo "=== Test Summary ===" + echo "TOTAL: ${all}" + echo "PASSED: ${passed}" + echo "FAILED: ${failed}" + echo "SKIPPED: ${skipped}" +) | tee -a ${LOG} diff --git a/recipes-support/libevent/libevent-morello_2.1.12.bb b/recipes-support/libevent/libevent-morello_2.1.12.bb new file mode 100644 index 0000000..fa5e5ff --- /dev/null +++ b/recipes-support/libevent/libevent-morello_2.1.12.bb @@ -0,0 +1,64 @@ +inherit autotools ptest purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-support/libevent/libevent_2.1.12.bb" + +SUMMARY = "An asynchronous event notification library" +DESCRIPTION = "A software library that provides asynchronous event \ +notification. The libevent API provides a mechanism to execute a callback \ +function when a specific event occurs on a file descriptor or after a \ +timeout has been reached. libevent also supports callbacks triggered \ +by signals and regular timeouts" +HOMEPAGE = "http://libevent.org/" +BUGTRACKER = "https://github.com/libevent/libevent/issues" +SECTION = "libs" + +FILESEXTRAPATHS:prepend := "${THISDIR}/patches:" +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +LICENSE = "BSD-3-Clause & MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=17f20574c0b154d12236d5fbe964f549" + +SRC_URI = "https://github.com/libevent/libevent/releases/download/release-%24%7BPV%7D-s... \ + file://Makefile-missing-test-dir.patch \ + file://run-ptest \ + file://0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch \ + file://0002-test-regress.h-Increase-default-timeval-tolerance-50.patch \ + file://0003-test-mark-util-monotonic_prc_fallback-as-retriable.patch \ + file://0004-test-retriable-tests-are-marked-failed-only-when-all-a.patch \ + " + +SRC_URI[sha256sum] = "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb" + +UPSTREAM_CHECK_URI = "http://libevent.org/" + +S = "${WORKDIR}/libevent-${PV}-stable" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl-morello" + +# Needed for Debian packaging +LEAD_SONAME = "libevent-2.1.so" + +PACKAGES_DYNAMIC = "^${PN}-.*$" +python split_libevent_libs () { + do_split_packages(d, '${libdir}', r'^libevent_([a-z]*)-.*.so..*', 'libevent-%s', '${SUMMARY} (%s)', prepend=True, allow_links=True) +} +PACKAGESPLITFUNCS:prepend = "split_libevent_libs " + +PTEST_PATH = "${libdir}/libevent/ptest" + +do_install:append() { + rm ${D}${bindir}/event_rpcgen.py + rmdir ${D}${bindir} +} + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/test + for file in ${B}/test/.libs/regress ${B}/test/.libs/test* + do + install -m 0755 $file ${D}${PTEST_PATH}/test + done + + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest +} \ No newline at end of file