Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Feb 2017 09:02:45 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r313471 - in projects/stable-10-backport-test-changes: contrib/netbsd-tests/lib/libc/db contrib/netbsd-tests/lib/libc/gen contrib/netbsd-tests/lib/libc/setjmp contrib/netbsd-tests/lib/l...
Message-ID:  <201702090902.v1992jT7063000@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Thu Feb  9 09:02:45 2017
New Revision: 313471
URL: https://svnweb.freebsd.org/changeset/base/313471

Log:
  MFC r288444,r296586,r301753,r303840,r304175:
  
  r288444 (by andrew):
  
  Pass 8 arguments to makecontext on arm64 as this is all we support.
  
  Obtained from:	EuroBSDCon Devsummit
  
  r296586 (by bdrewery):
  
  Fix and connect setjmp test.
  
  r301753:
  
  Fix up r274061
  
  Detect /usr/share/dict/words the "right way" by using require.files instead of
  the hacked up attempt in the dict(..) function, which didn't work properly on
  systems where MK_DICT == no.
  
  r303840 (by jhb):
  
  Add timer_settime tests using SIGEV_THREAD.
  
  Note that these tests should work fine on NetBSD and other systems as
  SIGEV_THREAD is POSIX.
  
  r304175 (by ed):
  
  Disable tests for non-standard behaviour of dirname(3)/basename(3).
  
  The NetBSD ATF tests explicitly check that these functions do not modify
  their input. These tests are NetBSD-specific. They test for something
  that is not part of POSIX.
  
  PR:		211873

Modified:
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/db/t_db.sh
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
  projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
  projects/stable-10-backport-test-changes/etc/mtree/BSD.tests.dist
  projects/stable-10-backport-test-changes/lib/libc/tests/Makefile
Directory Properties:
  projects/stable-10-backport-test-changes/   (props changed)

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/db/t_db.sh
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/db/t_db.sh	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/db/t_db.sh	Thu Feb  9 09:02:45 2017	(r313471)
@@ -37,6 +37,7 @@ dict()
 	elif [ -f /usr/dict/words ]; then
 		echo /usr/dict/words
 	else
+		echo ""
 		atf_fail "no dictionary found"
 	fi
 }
@@ -44,12 +45,7 @@ dict()
 # Begin FreeBSD
 dict()
 {
-	if [ -f /usr/share/dict/words ]; then
-		echo /usr/share/dict/words
-	else
-		echo /nonexistent
-		atf_skip "Test requires dict/words"
-	fi
+	echo /usr/share/dict/words
 }
 # End FreeBSD
 
@@ -62,6 +58,9 @@ small_btree_head()
 		"Checks btree database using small keys and small data" \
 		"pairs: takes the first hundred entries in the dictionary," \
 		"and makes them be key/data pairs."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 small_btree_body()
 {
@@ -88,6 +87,9 @@ small_hash_head()
 		"Checks hash database using small keys and small data" \
 		"pairs: takes the first hundred entries in the dictionary," \
 		"and makes them be key/data pairs."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 small_hash_body()
 {
@@ -114,6 +116,9 @@ small_recno_head()
 		"Checks recno database using small keys and small data" \
 		"pairs: takes the first hundred entries in the dictionary," \
 		"and makes them be key/data pairs."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 small_recno_body()
 {
@@ -138,6 +143,9 @@ medium_btree_head()
 		"Checks btree database using small keys and medium" \
 		"data pairs: takes the first 200 entries in the" \
 		"dictionary, and gives them each a medium size data entry."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 medium_btree_body()
 {
@@ -166,6 +174,9 @@ medium_hash_head()
 		"Checks hash database using small keys and medium" \
 		"data pairs: takes the first 200 entries in the" \
 		"dictionary, and gives them each a medium size data entry."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 medium_hash_body()
 {
@@ -731,6 +742,9 @@ small_page_btree_head()
 		"reverses them, and gives them each a small size data" \
 		"entry. Uses a small page size to make sure the btree" \
 		"split code gets hammered."
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 small_page_btree_body()
 {
@@ -784,6 +798,9 @@ atf_test_case byte_orders_btree
 byte_orders_btree_head()
 {
 	atf_set "descr" "Checks btree database using differing byte orders"
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 byte_orders_btree_body()
 {
@@ -816,6 +833,9 @@ bsize_ffactor_head()
 	atf_set "timeout" "480"
 	atf_set "descr" "Checks hash database with various" \
 					"bucketsizes and fill factors"
+	# Begin FreeBSD
+	atf_set "require.files" /usr/share/dict/words
+	# End FreeBSD
 }
 bsize_ffactor_body()
 {

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c	Thu Feb  9 09:02:45 2017	(r313471)
@@ -111,6 +111,7 @@ ATF_TC_BODY(basename_posix, tc)
 		} else
 			base = basename(NULL);
 
+#ifdef __NetBSD__
 		/*
 		 * basename(3) is allowed to modify the input buffer.
 		 * However, that is considered hostile by some programs,
@@ -127,6 +128,7 @@ ATF_TC_BODY(basename_posix, tc)
 			    test_basename_table[i].input);
 			atf_tc_fail("Input buffer was modified.");
 		}
+#endif
 
 		/* Make sure the result is correct. */
 		if (strcmp(test_basename_table[i].output, base) != 0) {
@@ -162,6 +164,7 @@ ATF_TC_BODY(dirname_posix, tc)
 		} else
 			base = dirname(NULL);
 
+#ifdef __NetBSD__
 		/*
 		 * dirname(3) is allowed to modify the input buffer.
 		 * However, that is considered hostile by some programs,
@@ -178,6 +181,7 @@ ATF_TC_BODY(dirname_posix, tc)
 			    test_dirname_table[i].input);
 			atf_tc_fail("Input buffer was modified.");
 		}
+#endif
 
 		/* Make sure the result is correct. */
 		if (strcmp(test_dirname_table[i].output, base) != 0) {

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c	Thu Feb  9 09:02:45 2017	(r313471)
@@ -87,7 +87,7 @@ __RCSID("$NetBSD: t_setjmp.c,v 1.1 2010/
 static int expectsignal;
 
 static void
-aborthandler(int signo)
+aborthandler(int signo __unused)
 {
 	ATF_REQUIRE_MSG(expectsignal, "kill(SIGABRT) succeeded");
 	atf_tc_pass();

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c	Thu Feb  9 09:02:45 2017	(r313471)
@@ -91,7 +91,7 @@ static pthread_t myself = NULL;
 static int expectsignal;
 
 static void
-aborthandler(int signo)
+aborthandler(int signo __unused)
 {
 	ATF_REQUIRE(myself == pthread_self());
 	ATF_REQUIRE_MSG(expectsignal, "kill(SIGABRT) succeeded");

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c	Thu Feb  9 09:02:45 2017	(r313471)
@@ -53,6 +53,8 @@ run(int n, ...)
 	va_start(va, n);
 #if defined(__FreeBSD__) && defined(__amd64__)
 	for (i = 0; i < 5; i++) {
+#elif defined(__FreeBSD__) && defined(__aarch64__)
+	for (i = 0; i < 7; i++) {
 #else
 	for (i = 0; i < 9; i++) {
 #endif
@@ -116,6 +118,10 @@ ATF_TC_BODY(setcontext_link, tc)
 		/* FreeBSD/amd64 only permits up to 6 arguments. */
 		makecontext(&uc[i], (void *)run, 6, i,
 			0, 1, 2, 3, 4);
+#elif defined(__FreeBSD__) && defined(__aarch64__)
+		/* FreeBSD/arm64 only permits up to 8 arguments. */
+		makecontext(&uc[i], (void *)run, 8, i,
+			0, 1, 2, 3, 4, 5, 6);
 #else
 		makecontext(&uc[i], (void *)run, 10, i,
 			0, 1, 2, 3, 4, 5, 6, 7, 8);

Modified: projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
==============================================================================
--- projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c	Thu Feb  9 09:02:45 2017	(r313471)
@@ -116,6 +116,61 @@ timer_signal_create(clockid_t cid, bool 
 	ATF_REQUIRE(timer_delete(t) == 0);
 }
 
+#ifdef __FreeBSD__
+static void
+timer_callback(union sigval value)
+{
+	timer_t *tp;
+
+	tp = value.sival_ptr;
+
+	if (*tp == t)
+		fail = false;
+}
+
+static void
+timer_thread_create(clockid_t cid, bool expire)
+{
+	struct itimerspec tim;
+	struct sigevent evt;
+
+	t = 0;
+	fail = true;
+
+	(void)memset(&evt, 0, sizeof(struct sigevent));
+	(void)memset(&tim, 0, sizeof(struct itimerspec));
+
+	/*
+	 * Create the timer (SIGEV_THREAD).
+	 */
+	evt.sigev_notify_function = timer_callback;
+	evt.sigev_value.sival_ptr = &t;
+	evt.sigev_notify = SIGEV_THREAD;
+
+	ATF_REQUIRE(timer_create(cid, &evt, &t) == 0);
+
+	/*
+	 * Start the timer.
+	 */
+	tim.it_value.tv_sec = expire ? 5 : 1;
+	tim.it_value.tv_nsec = 0;
+
+	ATF_REQUIRE(timer_settime(t, 0, &tim, NULL) == 0);
+
+	(void)sleep(2);
+
+	if (expire) {
+		if (!fail)
+			atf_tc_fail("timer fired too soon");
+	} else {
+		if (fail)
+			atf_tc_fail("timer failed to fire");
+	}
+
+	ATF_REQUIRE(timer_delete(t) == 0);
+}
+#endif
+
 ATF_TC(timer_create_err);
 ATF_TC_HEAD(timer_create_err, tc)
 {
@@ -198,6 +253,64 @@ ATF_TC_BODY(timer_create_mono_expire, tc
 	timer_signal_create(CLOCK_MONOTONIC, true);
 }
 
+ATF_TC(timer_thread_create_real);
+ATF_TC_HEAD(timer_thread_create_real, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+	    "SIGEV_THREAD");
+}
+
+#ifdef __FreeBSD__
+ATF_TC_BODY(timer_thread_create_real, tc)
+{
+	timer_thread_create(CLOCK_REALTIME, false);
+}
+
+ATF_TC(timer_thread_create_mono);
+ATF_TC_HEAD(timer_thread_create_mono, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+	    "SIGEV_THREAD");
+}
+
+ATF_TC_BODY(timer_thread_create_mono, tc)
+{
+	timer_thread_create(CLOCK_MONOTONIC, false);
+}
+
+ATF_TC(timer_thread_create_real_expire);
+ATF_TC_HEAD(timer_thread_create_real_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+	    "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_real_expire, tc)
+{
+	timer_thread_create(CLOCK_REALTIME, true);
+}
+
+ATF_TC(timer_thread_create_mono_expire);
+ATF_TC_HEAD(timer_thread_create_mono_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+	    "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_mono_expire, tc)
+{
+	timer_thread_create(CLOCK_MONOTONIC, true);
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -206,6 +319,12 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, timer_create_mono);
 	ATF_TP_ADD_TC(tp, timer_create_real_expire);
 	ATF_TP_ADD_TC(tp, timer_create_mono_expire);
+#ifdef __FreeBSD__
+	ATF_TP_ADD_TC(tp, timer_thread_create_real);
+	ATF_TP_ADD_TC(tp, timer_thread_create_mono);
+	ATF_TP_ADD_TC(tp, timer_thread_create_real_expire);
+	ATF_TP_ADD_TC(tp, timer_thread_create_mono_expire);
+#endif
 
 	return atf_no_error();
 }

Modified: projects/stable-10-backport-test-changes/etc/mtree/BSD.tests.dist
==============================================================================
--- projects/stable-10-backport-test-changes/etc/mtree/BSD.tests.dist	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/etc/mtree/BSD.tests.dist	Thu Feb  9 09:02:45 2017	(r313471)
@@ -123,6 +123,8 @@
             ..
             ssp
             ..
+            setjmp
+            ..
             stdio
             ..
             stdlib

Modified: projects/stable-10-backport-test-changes/lib/libc/tests/Makefile
==============================================================================
--- projects/stable-10-backport-test-changes/lib/libc/tests/Makefile	Thu Feb  9 08:41:04 2017	(r313470)
+++ projects/stable-10-backport-test-changes/lib/libc/tests/Makefile	Thu Feb  9 09:02:45 2017	(r313471)
@@ -17,6 +17,7 @@ TESTS_SUBDIRS+=	nss
 TESTS_SUBDIRS+=	regex
 TESTS_SUBDIRS+=	resolv
 TESTS_SUBDIRS+=	rpc
+TESTS_SUBDIRS+=	setjmp
 TESTS_SUBDIRS+=	stdio
 TESTS_SUBDIRS+=	stdlib
 TESTS_SUBDIRS+=	string



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702090902.v1992jT7063000>