CVS commit: src/tests/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:52:41 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtoi.c

Log Message:
Add range tests with trailing characters.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_strtoi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_strtoi.c
diff -u src/tests/lib/libc/stdlib/t_strtoi.c:1.2 src/tests/lib/libc/stdlib/t_strtoi.c:1.3
--- src/tests/lib/libc/stdlib/t_strtoi.c:1.2	Fri Apr 28 15:01:01 2017
+++ src/tests/lib/libc/stdlib/t_strtoi.c	Sat Jan 20 11:52:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtoi.c,v 1.2 2017/04/28 19:01:01 kamil Exp $	*/
+/*	$NetBSD: t_strtoi.c,v 1.3 2024/01/20 16:52:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_strtoi.c,v 1.2 2017/04/28 19:01:01 kamil Exp $");
+__RCSID("$NetBSD: t_strtoi.c,v 1.3 2024/01/20 16:52:41 christos Exp $");
 
 #include 
 #include 
@@ -235,6 +235,38 @@ ATF_TC_BODY(strtoi_range, tc)
 	}
 }
 
+ATF_TC(strtoi_range_trail);
+ATF_TC_HEAD(strtoi_range_trail, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test ERANGE from strtoi(3) "
+		"with trailing characters");
+}
+
+ATF_TC_BODY(strtoi_range_trail, tc)
+{
+	struct test t[] = {
+		{ "11x", 9, 10, "x", 0,	9, ERANGE },
+		{ " -3y", -2, 10, "y", -2, 1, ERANGE },
+	};
+
+	intmax_t rv;
+	char *end;
+	int e;
+	size_t i;
+
+	for (i = 0; i < __arraycount(t); i++) {
+
+		errno = 0;
+		rv = strtoi(t[i].str, , t[i].base, t[i].lo, t[i].hi, );
+
+		if (errno != 0)
+			atf_tc_fail("strtoi(3) changed errno to %d ('%s')",
+			e, strerror(e));
+
+		check([i], rv, end, e);
+	}
+}
+
 ATF_TC(strtoi_signed);
 ATF_TC_HEAD(strtoi_signed, tc)
 {
@@ -298,6 +330,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, strtoi_base);
 	ATF_TP_ADD_TC(tp, strtoi_case);
 	ATF_TP_ADD_TC(tp, strtoi_range);
+	ATF_TP_ADD_TC(tp, strtoi_range_trail);
 	ATF_TP_ADD_TC(tp, strtoi_signed);
 
 	return atf_no_error();



CVS commit: src/tests/lib/libc/stdlib

2024-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 16:52:41 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtoi.c

Log Message:
Add range tests with trailing characters.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_strtoi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2024-01-14 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Jan 14 12:44:09 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtod.c

Log Message:
s/rouding/rounding/ in test description.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/tests/lib/libc/stdlib/t_strtod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_strtod.c
diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.34 src/tests/lib/libc/stdlib/t_strtod.c:1.35
--- src/tests/lib/libc/stdlib/t_strtod.c:1.34	Tue Dec 22 14:19:25 2015
+++ src/tests/lib/libc/stdlib/t_strtod.c	Sun Jan 14 12:44:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtod.c,v 1.34 2015/12/22 14:19:25 christos Exp $ */
+/*	$NetBSD: t_strtod.c,v 1.35 2024/01/14 12:44:09 andvar Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Public domain, Otto Moerbeek , 2006. */
 
 #include 
-__RCSID("$NetBSD: t_strtod.c,v 1.34 2015/12/22 14:19:25 christos Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.35 2024/01/14 12:44:09 andvar Exp $");
 
 #include 
 #include 
@@ -231,7 +231,7 @@ ATF_TC_BODY(strtold_nan, tc)
 ATF_TC(strtod_round);
 ATF_TC_HEAD(strtod_round, tc)
 {
-	atf_tc_set_md_var(tc, "descr", "Test rouding in strtod(3)");
+	atf_tc_set_md_var(tc, "descr", "Test rounding in strtod(3)");
 }
 
 ATF_TC_BODY(strtod_round, tc)



CVS commit: src/tests/lib/libc/stdlib

2024-01-14 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Jan 14 12:44:09 UTC 2024

Modified Files:
src/tests/lib/libc/stdlib: t_strtod.c

Log Message:
s/rouding/rounding/ in test description.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/tests/lib/libc/stdlib/t_strtod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 12:09:39 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_posix_memalign.c

Log Message:
t_posix_memalign: Simplify.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 12:09:39 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_posix_memalign.c

Log Message:
t_posix_memalign: Simplify.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_posix_memalign.c
diff -u src/tests/lib/libc/stdlib/t_posix_memalign.c:1.7 src/tests/lib/libc/stdlib/t_posix_memalign.c:1.8
--- src/tests/lib/libc/stdlib/t_posix_memalign.c:1.7	Wed Jul  5 11:43:05 2023
+++ src/tests/lib/libc/stdlib/t_posix_memalign.c	Wed Jul  5 12:09:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $ */
+/*	$NetBSD: t_posix_memalign.c,v 1.8 2023/07/05 12:09:39 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $");
+__RCSID("$NetBSD: t_posix_memalign.c,v 1.8 2023/07/05 12:09:39 riastradh Exp $");
 
 #include 
 
@@ -189,19 +189,11 @@ ATF_TC_BODY(aligned_alloc_basic, tc)
 ATF_CHECK_EQ_MSG(p, NULL,
 "aligned_alloc(%zu, %zu): %p, %s",
 align[i], size[j], p, strerror(errno));
-switch (errno) {
-case EINVAL:
-case ENOMEM:
-	break;
-default:
-	atf_tc_fail_nonfatal(
-	"%s:%d:"
-	" aligned_alloc(%zu, %zu): %s",
-	__FILE__, __LINE__,
-	align[i], size[j],
-	strerror(errno));
-	break;
-}
+ATF_CHECK_MSG((errno == EINVAL ||
+	errno == ENOMEM),
+"aligned_alloc(%zu, %zu): %s",
+align[i], size[j],
+strerror(errno));
 continue;
 			}
 
@@ -219,15 +211,10 @@ ATF_TC_BODY(aligned_alloc_basic, tc)
 			"aligned_alloc(%zu, %zu): %p",
 			align[i], size[j], p);
 			if (size[j] != 0) {
-if (p == NULL) {
-	atf_tc_fail_nonfatal(
-	"%s:%d:"
-	" aligned_alloc(, %zu, %zu):"
-	" %p, %s",
-	__FILE__, __LINE__,
-	align[i], size[j], p,
-	strerror(errno));
-}
+ATF_CHECK_MSG(p != NULL,
+"aligned_alloc(, %zu, %zu): %p, %s",
+align[i], size[j], p,
+strerror(errno));
 			} else {
 /*
  * No guarantees about whether



CVS commit: src/tests/lib/libc/stdlib

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 11:43:05 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_posix_memalign.c

Log Message:
t_posix_memalign: Fix this to reflect restriction lifted in C17.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_posix_memalign.c
diff -u src/tests/lib/libc/stdlib/t_posix_memalign.c:1.6 src/tests/lib/libc/stdlib/t_posix_memalign.c:1.7
--- src/tests/lib/libc/stdlib/t_posix_memalign.c:1.6	Tue Jul  4 15:06:36 2023
+++ src/tests/lib/libc/stdlib/t_posix_memalign.c	Wed Jul  5 11:43:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $ */
+/*	$NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $");
+__RCSID("$NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $");
 
 #include 
 
@@ -152,20 +152,19 @@ ATF_TC_BODY(aligned_alloc_basic, tc)
 			void *const p = aligned_alloc(align[i], size[j]);
 
 			/*
-			 * C11, 6.2.8 Alignment of objects, paragraph
-			 * 4, p. 48:
+			 * C17, 6.2.8 Alignment of objects, paragraph
+			 * 4, p. 37:
 			 *
 			 *	Every valid alignment value shall be a
 			 *	nonnegative integral power of two.
 			 *
-			 * C11, 7.22.3.1 The aligned_alloc function,
+			 * C17, 7.22.3.1 The aligned_alloc function,
 			 * paragraph 2, p. 348:
 			 *
-			 *	The value of alignment shall be a valid
-			 *	alignment supported by the
-			 *	implementation and the value of size
-			 *	shall be an integral multiple of
-			 *	alignment.
+			 *	If the value of alignment is not a
+			 *	valid alignment supported by the
+			 *	implementation the function shall fail
+			 *	by returning a null pointer.
 			 *
 			 * Setting errno to EINVAL is a NetBSD
 			 * extension.  The last clause appears to rule
@@ -173,8 +172,7 @@ ATF_TC_BODY(aligned_alloc_basic, tc)
 			 * not clear.
 			 */
 			if (align[i] == 0 ||
-			(align[i] & (align[i] - 1)) != 0 ||
-			(size[j] != 0 && size[j] % align[i] != 0)) {
+			(align[i] & (align[i] - 1)) != 0) {
 if (p != NULL) {
 	ATF_CHECK_EQ_MSG(p, NULL,
 	"aligned_alloc(%zu, %zu): %p",



CVS commit: src/tests/lib/libc/stdlib

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 11:43:05 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_posix_memalign.c

Log Message:
t_posix_memalign: Fix this to reflect restriction lifted in C17.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2023-07-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul  4 15:06:36 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: Makefile t_posix_memalign.c

Log Message:
t_posix_memalign: Expand test cases and properties.

- Test cartesian product of a sampling of sizes and a sampling of
  alignments.

- Verify all the edge cases I could find in posix_memalign and
  aligned_alloc, including failure modes.

- Test an unreasonably large (but aligned) allocation size.

- Use ATF_CHECK_* instead of ATF_REQUIRE_* so all failures will be
  reported, not just the first one.

- While here, build with -fno-builtin-aligned_alloc and with
  -fno-builtin-posix_memalign to make sure the compiler doesn't try
  any shenanigans.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libc/stdlib/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/Makefile
diff -u src/tests/lib/libc/stdlib/Makefile:1.33 src/tests/lib/libc/stdlib/Makefile:1.34
--- src/tests/lib/libc/stdlib/Makefile:1.33	Wed Jul  1 07:16:37 2020
+++ src/tests/lib/libc/stdlib/Makefile	Tue Jul  4 15:06:36 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2020/07/01 07:16:37 jruoho Exp $
+# $NetBSD: Makefile,v 1.34 2023/07/04 15:06:36 riastradh Exp $
 
 .include 
 
@@ -31,6 +31,9 @@ BINDIR=		${TESTSDIR}
 PROGS+=		h_atexit
 PROGS+=		h_getopt h_getopt_long
 
+CFLAGS.t_posix_memalign.c+=	-fno-builtin-posix_memalign
+CFLAGS.t_posix_memalign.c+=	-fno-builtin-aligned_alloc
+
 CPPFLAGS.t_strtod.c+=  -D__TEST_FENV
 LDADD.t_strtod=			-lm
 DPADD.t_strtod+=		${LIBM}

Index: src/tests/lib/libc/stdlib/t_posix_memalign.c
diff -u src/tests/lib/libc/stdlib/t_posix_memalign.c:1.5 src/tests/lib/libc/stdlib/t_posix_memalign.c:1.6
--- src/tests/lib/libc/stdlib/t_posix_memalign.c:1.5	Sun Jul 29 01:45:25 2018
+++ src/tests/lib/libc/stdlib/t_posix_memalign.c	Tue Jul  4 15:06:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_posix_memalign.c,v 1.5 2018/07/29 01:45:25 maya Exp $ */
+/*	$NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_memalign.c,v 1.5 2018/07/29 01:45:25 maya Exp $");
+__RCSID("$NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $");
 
 #include 
 
@@ -43,6 +43,8 @@ __RCSID("$NetBSD: t_posix_memalign.c,v 1
 #include 
 #include 
 
+#define	rounddown(x, n)	(((x) / (n)) * (n))
+
 ATF_TC(posix_memalign_basic);
 ATF_TC_HEAD(posix_memalign_basic, tc)
 {
@@ -50,32 +52,77 @@ ATF_TC_HEAD(posix_memalign_basic, tc)
 }
 ATF_TC_BODY(posix_memalign_basic, tc)
 {
-	static const size_t size[] = {
-		1, 2, 3, 4, 10, 100, 16384, 32768, 65536
-	};
+	enum { maxaligntest = 16384 };
 	static const size_t align[] = {
-		512, 1024, 16, 32, 64, 4, 2048, 16, 2
+		0, 1, 2, 3, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096,
+		8192, maxaligntest,
+	};
+	static const size_t size[] = {
+		0, 1, 2, 3, 4, 10, 100, 1, 16384, 32768, 65536,
+		rounddown(SIZE_MAX, maxaligntest),
 	};
+	size_t i, j;
 
-	size_t i;
-	void *p;
+	for (i = 0; i < __arraycount(align); i++) {
+		for (j = 0; j < __arraycount(size); j++) {
+			void *p = (void *)0x1;
+			const int ret = posix_memalign(, align[i], size[j]);
+
+			if (align[i] == 0 ||
+			(align[i] & (align[i] - 1)) != 0 ||
+			align[i] < sizeof(void *)) {
+ATF_CHECK_EQ_MSG(ret, EINVAL,
+"posix_memalign(, %zu, %zu): %s",
+align[i], size[j], strerror(ret));
+continue;
+			}
+			if (size[j] == rounddown(SIZE_MAX, maxaligntest) &&
+			ret != EINVAL) {
+/*
+ * If obscenely large alignment isn't
+ * rejected as EINVAL, we can't
+ * allocate that much memory anyway.
+ */
+ATF_CHECK_EQ_MSG(ret, ENOMEM,
+"posix_memalign(, %zu, %zu): %s",
+align[i], size[j], strerror(ret));
+continue;
+			}
+
+			/*
+			 * Allocation should fail only if the alignment
+			 * isn't supported, in which case it will fail
+			 * with EINVAL.  No standard criterion for what
+			 * alignments are supported, so just stop here
+			 * on EINVAL.
+			 */
+			if (ret == EINVAL)
+continue;
+
+			ATF_CHECK_EQ_MSG(ret, 0,
+			"posix_memalign(, %zu, %zu): %s",
+			align[i], size[j], strerror(ret));
+			ATF_CHECK_EQ_MSG((intptr_t)p & (align[i] - 1), 0,
+			"posix_memalign(, %zu, %zu): %p",
+			align[i], size[j], p);
+
+			if (size[j] != 0) {
+if (p == NULL) {
+	atf_tc_fail_nonfatal(
+	"%s:%d:"
+	"posix_memalign(, %zu, %zu):"
+	" %p",
+	__FILE__, __LINE__,
+	align[i], size[j], p);
+}
+			} else {
+/*
+ * No guarantees about whether
+ * zero-size allocation yields null
+ 

CVS commit: src/tests/lib/libc/stdlib

2023-07-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul  4 15:06:36 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: Makefile t_posix_memalign.c

Log Message:
t_posix_memalign: Expand test cases and properties.

- Test cartesian product of a sampling of sizes and a sampling of
  alignments.

- Verify all the edge cases I could find in posix_memalign and
  aligned_alloc, including failure modes.

- Test an unreasonably large (but aligned) allocation size.

- Use ATF_CHECK_* instead of ATF_REQUIRE_* so all failures will be
  reported, not just the first one.

- While here, build with -fno-builtin-aligned_alloc and with
  -fno-builtin-posix_memalign to make sure the compiler doesn't try
  any shenanigans.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libc/stdlib/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/stdlib/t_posix_memalign.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2023-05-10 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed May 10 23:44:15 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_getopt.sh

Log Message:
t_getopt.sh: fix naming of head() of getopt_optval test case


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_getopt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_getopt.sh
diff -u src/tests/lib/libc/stdlib/t_getopt.sh:1.2 src/tests/lib/libc/stdlib/t_getopt.sh:1.3
--- src/tests/lib/libc/stdlib/t_getopt.sh:1.2	Mon Feb 20 15:47:56 2023
+++ src/tests/lib/libc/stdlib/t_getopt.sh	Wed May 10 23:44:15 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_getopt.sh,v 1.2 2023/02/20 15:47:56 christos Exp $
+# $NetBSD: t_getopt.sh,v 1.3 2023/05/10 23:44:15 gutteridge Exp $
 #
 # Copyright (c) 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -66,7 +66,7 @@ getopt_body()
 }
 
 atf_test_case getopt_optval
-getopt_optval()
+getopt_optval_head()
 {
 	atf_set "descr" "Checks getopt(3) with optional value"
 }



CVS commit: src/tests/lib/libc/stdlib

2023-05-10 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed May 10 23:44:15 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_getopt.sh

Log Message:
t_getopt.sh: fix naming of head() of getopt_optval test case


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_getopt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/stdlib

2023-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 20 15:47:56 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_getopt.sh

Log Message:
New optval test from des @ FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/stdlib/t_getopt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/t_getopt.sh
diff -u src/tests/lib/libc/stdlib/t_getopt.sh:1.1 src/tests/lib/libc/stdlib/t_getopt.sh:1.2
--- src/tests/lib/libc/stdlib/t_getopt.sh:1.1	Sat Jan  1 18:56:49 2011
+++ src/tests/lib/libc/stdlib/t_getopt.sh	Mon Feb 20 10:47:56 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_getopt.sh,v 1.1 2011/01/01 23:56:49 pgoyette Exp $
+# $NetBSD: t_getopt.sh,v 1.2 2023/02/20 15:47:56 christos Exp $
 #
 # Copyright (c) 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -65,6 +65,18 @@ getopt_body()
 	h_getopt "${load}" "foo -d - 1" "d|2"
 }
 
+atf_test_case getopt_optval
+getopt_optval()
+{
+	atf_set "descr" "Checks getopt(3) with optional value"
+}
+getopt_optval_body()
+{
+	h_getopt "o::" "foo -o" "o=(null)|0"
+	h_getopt "o::" "foo -o1 2" "o=1|1"
+	h_getopt "o::" "foo -o 1 2" "o=(null)|2"
+}
+
 atf_test_case getopt_long
 getopt_long_head()
 {
@@ -119,5 +131,6 @@ longopt:	list, no_argument, lopt, 'l'"
 atf_init_test_cases()
 {
 	atf_add_test_case getopt
+	atf_add_test_case getopt_optval
 	atf_add_test_case getopt_long
 }



CVS commit: src/tests/lib/libc/stdlib

2023-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 20 15:47:56 UTC 2023

Modified Files:
src/tests/lib/libc/stdlib: t_getopt.sh

Log Message:
New optval test from des @ FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/stdlib/t_getopt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/tests/lib/libc/stdlib

2020-06-27 Thread Jukka Ruohonen
On Sat, Jun 27, 2020 at 10:39:08AM +, m...@netbsd.org wrote:
> > Add the default TNF copyright (2005), cf. PR misc/55419.
> 
> I don't think we can generally do this. Can you clarify if you discussed
> this with the author in commit messages?

Well, the committer is christos, and I doubt he cares.  But as noted in the
test, this 15 year old code snippet is from another person.  Like with many
test cases, I suppose it was originally taken/modified from a PR or a
mailing list.

As I noted in PR misc/55419, the problem is generic. I doubt whether it is
even possible to contact all people whose code appears in src/tests. But I
guess at least all NetBSD people should add the meta-data if they have code
in src/tests.

- Jukka



Re: CVS commit: src/tests/lib/libc/stdlib

2020-06-27 Thread maya
On Sat, Jun 27, 2020 at 10:19:43AM +, Jukka Ruohonen wrote:
> Module Name:  src
> Committed By: jruoho
> Date: Sat Jun 27 10:19:43 UTC 2020
> 
> Modified Files:
>   src/tests/lib/libc/stdlib: t_mbtowc.c
> 
> Log Message:
> Add the default TNF copyright (2005), cf. PR misc/55419.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/stdlib/t_mbtowc.c
> 

I don't think we can generally do this. Can you clarify if you discussed
this with the author in commit messages?

Thanks.


Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Jukka Ruohonen
On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name:  src
 Committed By: haad
 Date: Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
   src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion

Can you note the architecture and explain the overflow so that I can
learn something?

- Jukka.


Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Adam Hamsik

On Jun,Sunday 5 2011, at 12:58 AM, Jukka Ruohonen wrote:

 On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name: src
 Committed By:haad
 Date:Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
  src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion
 
 Can you note the architecture and explain the overflow so that I can
 learn something?

Architecture i386 - PAE,

#   compile  kern/strtoull.o
/usr/devel/buildslave/obj/i386/tooldir/bin/i486--netbsdelf-gcc -O2 -Wall -Os 
-ffreestanding -std=gnu99 -Werror  -march=i386 -mtune=i386  
--sysroot=/usr/devel/buildslave/obj/i386/destdir.i386 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/arch/i386
 --sysroot=/usr/devel/buildslave/obj/i386/destdir.i386 -DSLOW -DSUPPORT_BOOTP 
-DSUPPORT_DHCP -DSUPPORT_TFTP -DBOOTROM -DRELOC=0x9 -nostdinc 
-I/usr/devel/buildslave/obj/i386/sys/arch/i386/stand/netboot/3c509 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../..
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../arch/i386/stand/lib
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libsa
 -D_STANDALONE 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/quad
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/arch/i386/string
  
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/quad
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/arch/i386/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/include
  -c
/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/stdlib/strtoull.c
 -o strtoull.o
--- dependall-tests ---
cc1: warnings being treated as errors
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c: In function 
'atfu_strtol_base_body':
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c:95: warning: 
overflow in implicit constant conversion
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c:96: warning: 
overflow in implicit constant conversion
*** [t_strtol.o] Error code 1
nbmake: stopped in /usr/devel/buildslave/full/build/tests/lib/libc/stdlib
1 error
nbmake: stopped in /usr/devel/buildslave/full/build/tests/lib/libc/stdlib

Please revert/fix my commit if I did it wrong. But I can compile -current with 
it.

Regards

Adam.



Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Matt Thomas

On Jun 4, 2011, at 4:35 PM, Adam Hamsik wrote:

 
 On Jun,Sunday 5 2011, at 12:58 AM, Jukka Ruohonen wrote:
 
 On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name:src
 Committed By:   haad
 Date:   Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
 src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion
 
 Can you note the architecture and explain the overflow so that I can
 learn something?
 
 Architecture i386 - PAE,

also dies on powerpc.


Re: CVS commit: src/tests/lib/libc/stdlib

2011-05-10 Thread Cliff Neighbors
Jukka,

#include fenv.h as part of this seems to have caused build.sh to break on arch 
evbmips64-eb 

 In file included from 
 /home/cliff/netbsd/NetBSD-current/usr/src/tests/lib/libc/s
 tdlib/t_strtod.c:38:
 /home/cliff/netbsd/NetBSD-current/build/evbmips64-eb-20110510/dest/usr/include/f
 env.h:29:2: error: #error fenv.h is currently not supported for this 
 architectu
 re
 /home/cliff/netbsd/NetBSD-current/build/evbmips64-eb-20110510/dest/usr/include/f
 env.h:35:26: error: machine/fenv.h: No such file or directory
 nbmkdep: compile failed.
 *** [t_strtod.d] Error code 1
 

do we need #ifdef Honor_FLT_ROUNDS around that include?

 -cliff-




On May 10, 2011, at 8:20 AM, Jukka Ruohonen wrote:

 Module Name:  src
 Committed By: jruoho
 Date: Tue May 10 15:20:19 UTC 2011
 
 Modified Files:
   src/tests/lib/libc/stdlib: t_strtod.c
 
 Log Message:
 Verify that strtod(3) honors the current rounding mode set by fesetround(3).
 Passes on amd64. Prompted by a bug in the GNU C library.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/stdlib/t_strtod.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 



Re: CVS commit: src/tests/lib/libc/stdlib

2011-05-10 Thread Jukka Ruohonen
On Tue, May 10, 2011 at 11:37:16AM -0700, Cliff Neighbors wrote:
  In file included from 
  /home/cliff/netbsd/NetBSD-current/usr/src/tests/lib/libc/s
  tdlib/t_strtod.c:38:
  /home/cliff/netbsd/NetBSD-current/build/evbmips64-eb-20110510/dest/usr/include/f
  env.h:29:2: error: #error fenv.h is currently not supported for this 
  architectu
  re
  /home/cliff/netbsd/NetBSD-current/build/evbmips64-eb-20110510/dest/usr/include/f
  env.h:35:26: error: machine/fenv.h: No such file or directory
  nbmkdep: compile failed.
  *** [t_strtod.d] Error code 1
  
 
 do we need #ifdef Honor_FLT_ROUNDS around that include?

Hmm, I guess so. Or #ifndef NO_FENV_H? I am not familiar with the
conditional compilation of gdtoa.

- Jukka.