From 5db3ac1b341d71bf80272e755b1d1b6ecf196df6 Mon Sep 17 00:00:00 2001 From: Leorize Date: Sun, 31 Dec 2017 10:05:35 +0700 Subject: [PATCH] dev-libs/atf: new recipe (#2026) --- dev-libs/atf/atf-0.21.recipe | 112 +++++++++++++++++++++ dev-libs/atf/patches/atf-0.21.patchset | 129 +++++++++++++++++++++++++ 2 files changed, 241 insertions(+) create mode 100644 dev-libs/atf/atf-0.21.recipe create mode 100644 dev-libs/atf/patches/atf-0.21.patchset diff --git a/dev-libs/atf/atf-0.21.recipe b/dev-libs/atf/atf-0.21.recipe new file mode 100644 index 000000000..2a42de895 --- /dev/null +++ b/dev-libs/atf/atf-0.21.recipe @@ -0,0 +1,112 @@ +SUMMARY="Libraries to write tests in C, C++ and shell" +DESCRIPTION="ATF, or Automated Testing Framework, is a collection of libraries \ +to write test programs in C, C++ and POSIX shell. + +The ATF libraries offer a simple API. The API is orthogonal through \ +the various bindings, allowing developers to quickly learn how to write \ +test programs in different languages. + +ATF-based test programs offer a consistent end-user command-line interface to \ +allow both humans and automation to run the tests. + +ATF-based test programs rely on an execution engine to be run and \ +this execution engine is not shipped with ATF. Kyua is the engine of choice." +HOMEPAGE="https://github.com/jmmv/atf" +COPYRIGHT="2007-2012 The NetBSD Foundation, Inc. + 2011, 2012, 2014 Google Inc." +LICENSE="BSD (2-clause) + BSD (3-clause)" +REVISION="1" +SOURCE_URI="https://github.com/jmmv/atf/releases/download/atf-$portVersion/atf-$portVersion.tar.gz" +CHECKSUM_SHA256="92bc64180135eea8fe84c91c9f894e678767764f6dbc8482021d4dde09857505" +PATCHES="atf-$portVersion.patchset" + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +SECONDARY_ARCHITECTURES="x86" + +commandSuffix="$secondaryArchSuffix" +if [ "$targetArchitecture" = x86_gcc2 ]; then + commandSuffix="" +fi + +libVersion="1.0.0" +libCppVersion="2.0.0" +libVersionCompat="$libVersion compat >= ${libVersion%%.*}" +libCppVersionCompat="$libCppVersion compat >= ${libCppVersion%%.*}" + +PROVIDES=" + atf$secondaryArchSuffix = $portVersion + cmd:atf_sh$secondaryArchSuffix = $portVersion + lib:libatf_c$secondaryArchSuffix = $libVersionCompat + lib:libatf_c++$secondaryArchSuffix = $libCppVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +PROVIDES_devel=" + atf${secondaryArchSuffix}_devel = $portVersion + devel:libatf_c$secondaryArchSuffix = $libVersionCompat + devel:libatf_c++$secondaryArchSuffix = $libCppVersionCompat + " +REQUIRES_devel=" + atf$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:autoconf + cmd:awk + cmd:g++$secondaryArchSuffix + cmd:gcc$secondaryArchSuffix + cmd:grep + cmd:make + cmd:sed + " + +TEST_REQUIRES=" + cmd:kyua$commandSuffix + " + +defineDebugInfoPackage atf$secondaryArchSuffix \ + "$binDir/atf-sh" \ + "$libDir/libatf-c.so.$libVersion" \ + "$libDir/libatf-c++.so.$libCppVersion" + +BUILD() +{ + CPPFLAGS="-D_BSD_SOURCE" LIBS="-Wl,--as-needed -lbsd" \ + runConfigure --omit-dirs "libExecDir" ./configure \ + --libexecdir="$libExecDir/atf" \ + --enable-developer=no + make $jobArgs +} + +INSTALL() +{ + make install + + rm "$docDir"/{COPYING,README} + + rm -rf "$prefix/tests" + rm -f "$libDir"/*.la + + prepareInstalledDevelLibs libatf-c++ libatf-c + fixPkgconfig + # Turns out their .pc files don't have ${prefix} + sed -e "s|\${prefix}|$prefix|g" -i "$developLibDir/pkgconfig"/*.pc + sed \ + -e "s|\${exec_prefix}/bin/atf-sh|$binDir/atf-sh|" \ + -i "$developLibDir/pkgconfig/atf-sh.pc" + packageEntries devel \ + "$developDir" \ + "$dataDir/aclocal" \ + "$manDir/man3"/atf-c* +} + +TEST() +{ + CPATH="$PWD" kyua test +} diff --git a/dev-libs/atf/patches/atf-0.21.patchset b/dev-libs/atf/patches/atf-0.21.patchset new file mode 100644 index 000000000..4b1a99371 --- /dev/null +++ b/dev-libs/atf/patches/atf-0.21.patchset @@ -0,0 +1,129 @@ +From f498f903f70b7b80fe62ff3fb4da4a342758eb47 Mon Sep 17 00:00:00 2001 +From: Leorize +Date: Sun, 31 Dec 2017 10:22:49 +0700 +Subject: add Haiku support + + +diff --git a/atf-c++/check_test.cpp b/atf-c++/check_test.cpp +index 7baf3fa..aa9b9b6 100644 +--- a/atf-c++/check_test.cpp ++++ b/atf-c++/check_test.cpp +@@ -292,7 +292,11 @@ ATF_TEST_CASE_BODY(exec_exitstatus) + do_exec(this, "exit-signal"); + ATF_REQUIRE(!r->exited()); + ATF_REQUIRE(r->signaled()); ++#if defined(__HAIKU__) ++ ATF_REQUIRE_EQ(r->termsig(), SIGKILLTHR); ++#else + ATF_REQUIRE_EQ(r->termsig(), SIGKILL); ++#endif + } + } + +diff --git a/atf-c++/detail/fs.cpp b/atf-c++/detail/fs.cpp +index bcef920..3476608 100644 +--- a/atf-c++/detail/fs.cpp ++++ b/atf-c++/detail/fs.cpp +@@ -32,7 +32,9 @@ + extern "C" { + #include + #include ++#ifndef __HAIKU__ + #include ++#endif + #include + #include + #include +diff --git a/atf-c/check_test.c b/atf-c/check_test.c +index adaca64..b84337f 100644 +--- a/atf-c/check_test.c ++++ b/atf-c/check_test.c +@@ -385,7 +385,11 @@ ATF_TC_BODY(exec_exitstatus, tc) + do_exec(tc, "exit-signal", &result); + ATF_CHECK(!atf_check_result_exited(&result)); + ATF_CHECK(atf_check_result_signaled(&result)); ++#if defined(__HAIKU__) ++ ATF_CHECK(atf_check_result_termsig(&result) == SIGKILLTHR); ++#else + ATF_CHECK(atf_check_result_termsig(&result) == SIGKILL); ++#endif + atf_check_result_fini(&result); + } + } +diff --git a/atf-c/detail/fs.c b/atf-c/detail/fs.c +index 5ff7648..4740bbd 100644 +--- a/atf-c/detail/fs.c ++++ b/atf-c/detail/fs.c +@@ -31,7 +31,9 @@ + + #include + #include ++#ifndef __HAIKU__ + #include ++#endif + #include + #include + +diff --git a/atf-c/detail/process_test.c b/atf-c/detail/process_test.c +index 5ae5565..9ce030b 100644 +--- a/atf-c/detail/process_test.c ++++ b/atf-c/detail/process_test.c +@@ -635,7 +635,11 @@ ATF_TC_BODY(status_signaled, tc) + RE(atf_process_status_init(&s, rawstatus)); + ATF_CHECK(!atf_process_status_exited(&s)); + ATF_CHECK(atf_process_status_signaled(&s)); ++#if defined(__HAIKU__) ++ ATF_CHECK_EQ(atf_process_status_termsig(&s), SIGKILLTHR); ++#else + ATF_CHECK_EQ(atf_process_status_termsig(&s), SIGKILL); ++#endif + ATF_CHECK(!atf_process_status_coredump(&s)); + atf_process_status_fini(&s); + } +-- +2.15.0 + + +From 26850579ebf31b997bbdd3ea2b29db0b85a78494 Mon Sep 17 00:00:00 2001 +From: Leorize +Date: Fri, 5 Jan 2018 20:38:11 +0700 +Subject: tests: disable tests that requires atf installed + + +diff --git a/Kyuafile b/Kyuafile +index a65bb53..d85251d 100644 +--- a/Kyuafile ++++ b/Kyuafile +@@ -4,5 +4,3 @@ test_suite("atf") + + include("atf-c/Kyuafile") + include("atf-c++/Kyuafile") +-include("atf-sh/Kyuafile") +-include("test-programs/Kyuafile") +diff --git a/atf-c++/Kyuafile b/atf-c++/Kyuafile +index 9fd43af..5de8481 100644 +--- a/atf-c++/Kyuafile ++++ b/atf-c++/Kyuafile +@@ -6,7 +6,6 @@ atf_test_program{name="atf_c++_test"} + atf_test_program{name="build_test"} + atf_test_program{name="check_test"} + atf_test_program{name="macros_test"} +-atf_test_program{name="pkg_config_test"} + atf_test_program{name="tests_test"} + atf_test_program{name="utils_test"} + +diff --git a/atf-c/Kyuafile b/atf-c/Kyuafile +index 40fdb92..fa471c9 100644 +--- a/atf-c/Kyuafile ++++ b/atf-c/Kyuafile +@@ -7,7 +7,6 @@ atf_test_program{name="build_test"} + atf_test_program{name="check_test"} + atf_test_program{name="error_test"} + atf_test_program{name="macros_test"} +-atf_test_program{name="pkg_config_test"} + atf_test_program{name="tc_test"} + atf_test_program{name="tp_test"} + atf_test_program{name="utils_test"} +-- +2.15.0 +