From 8864cde3495dbfd6b476c1b77a8bde035e1cf000 Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Feb 2017 01:13:12 +0000 Subject: MFC r305358,r305449,r305451,r306367,r306397,r309474: This also contains a merge of ^/projects/netbsd-tests-update-12@r304035 . This change never hit ^/head because bin/cat's behavior was changed (on ^/head) to match NetBSD. PR: 210607 r305358: Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox r305449: Install h_db to unbreak some of the lib/libc/db testcases after r305358 r305451: Fix lib/libc/rpc test assumptions added in r305358 - Require root in the tcp/udp subtests (it's needed on FreeBSD when registering services). - Skip the tests if service registration fails. r306367 (by br): Allow up to 6 arguments only on MIPS. r306397 (by br): Use right piece of code for FreeBSD. r309474: Don't build :strvis_locale if VIS_NOLOCALE is undefined The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower in conditionally running the test instead of backporting the newer version of libc-vis --- .../usr.bin/xlint/lint1/d_c99_anon_struct.c | 26 ++++++++++++++++++++++ .../xlint/lint1/d_c99_compound_literal_comma.c | 14 ++++++++++++ .../usr.bin/xlint/lint1/d_c99_flex_array_packed.c | 6 +++++ .../usr.bin/xlint/lint1/d_c99_nested_struct.c | 25 +++++++++++++++++++++ .../usr.bin/xlint/lint1/d_c99_union_init4.c | 15 +++++++++++++ .../usr.bin/xlint/lint1/d_cast_fun_array_param.c | 9 ++++++++ .../usr.bin/xlint/lint1/d_type_question_colon.c | 14 ++++++++++++ .../netbsd-tests/usr.bin/xlint/lint1/d_typefun.c | 22 ++++++++++++++++++ 8 files changed, 131 insertions(+) create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c (limited to 'contrib/netbsd-tests/usr.bin/xlint/lint1') diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c new file mode 100644 index 0000000..367b56f --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c @@ -0,0 +1,26 @@ +/* Anonymous struct test */ + +typedef int type; + +struct point { + int x; + int y; +}; + +struct bar { + struct { + struct point top_left; + struct point bottom_right; + }; + type z; +}; + + +int +main(void) +{ + struct bar b; + b.top_left.x = 1; + return 0; +} + diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c new file mode 100644 index 0000000..ca70694 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c @@ -0,0 +1,14 @@ +struct bintime { + unsigned long long sec; + unsigned long long frac; +}; + +struct bintime +us2bintime(unsigned long long us) +{ + + return (struct bintime) { + .sec = us / 1000000U, + .frac = (((us % 1000000U) >> 32)/1000000U) >> 32, + }; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c new file mode 100644 index 0000000..e7b8756 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c @@ -0,0 +1,6 @@ +/* Allow packed c99 flexible arrays */ +struct { + int x; + char y[0]; +} __packed foo; + diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c new file mode 100644 index 0000000..15410c8 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c @@ -0,0 +1,25 @@ +/* C99 nested struct init with named and non-named initializers */ +typedef struct pthread_mutex_t { + unsigned int ptm_magic; + char ptm_errorcheck; + + char ptm_pad1[3]; + + char ptm_interlock; + + char ptm_pad2[3]; + + volatile void * ptm_owner; + void * volatile ptm_waiters; + unsigned int ptm_recursed; + void *ptm_spare2; +} pthread_mutex_t; + + +struct arc4random_global { + + pthread_mutex_t lock; +} arc4random_global = { + + .lock = { 0x33330003, 0, { 0, 0, 0 }, 0, { 0, 0, 0 }, ((void *)0), ((void *)0), 0, ((void *)0) }, +}; diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c new file mode 100644 index 0000000..f73b113 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c @@ -0,0 +1,15 @@ +/* test .data.l[x] */ +typedef struct { + int type; + union { + char b[20]; + short s[10]; + long l[5]; + } data; +} foo; + + +foo bar = { + .type = 3, + .data.l[0] = 4 +}; diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c new file mode 100644 index 0000000..345c783 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c @@ -0,0 +1,9 @@ + +static void f(void *b[4]) { + (void)&b; +} + +void * +foo(void *fn) { + return fn == 0 ? f : (void (*)(void *[4])) fn; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c new file mode 100644 index 0000000..00f69cd --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c @@ -0,0 +1,14 @@ +/* the type of the ?: expression should be the more specific type */ + +struct foo { + int bar; +}; + +void +test(void) { + int i; + struct foo *ptr = 0; + + for (i = (ptr ? ptr : (void *)0)->bar; i < 10; i++) + test(); +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c new file mode 100644 index 0000000..ad69c51 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c @@ -0,0 +1,22 @@ +/* typedef of function parameter */ + +typedef void (*free_func) (void * opaque, void* address); +typedef struct stack_st +{ + int num; + char **data; + int sorted; + + int num_alloc; + int (*comp)(const void *, const void *); +} _STACK; /* Use STACK_OF(...) instead */ + +typedef void *OPENSSL_BLOCK; +struct stack_st_OPENSSL_BLOCK { _STACK stack; }; +typedef void *d2i_of_void(void **,const unsigned char **,long); typedef int i2d_of_void(void *,unsigned char **); + +struct stack_st_OPENSSL_BLOCK *d2i_ASN1_SET(struct stack_st_OPENSSL_BLOCK **a, + const unsigned char **pp, + long length, d2i_of_void *d2i, + void (*free_func)(OPENSSL_BLOCK), int ex_tag, + int ex_class); -- cgit v1.1 From b39322d52d2dd66d37af0ffcbfb48d13896804ea Mon Sep 17 00:00:00 2001 From: ngie Date: Fri, 10 Feb 2017 07:13:16 +0000 Subject: MFC r311925,r311968,r311969,r312008: r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312008: Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386 --- .../usr.bin/xlint/lint1/d_c99_anon_union.c | 16 ++++++++++++++++ .../usr.bin/xlint/lint1/d_c99_union_cast.c | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c create mode 100644 contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c (limited to 'contrib/netbsd-tests/usr.bin/xlint/lint1') diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c new file mode 100644 index 0000000..508bcc9 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c @@ -0,0 +1,16 @@ +/* struct with only anonymous members */ + +struct foo { + union { + long loo; + double doo; + }; +}; + +int +main(void) { + + struct foo *f = 0; + printf("%p\n", &f[1]); + return 0; +} diff --git a/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c new file mode 100644 index 0000000..31628b4 --- /dev/null +++ b/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c @@ -0,0 +1,18 @@ +/* union cast */ + +struct bar { + int a; + int b; +}; + +union foo { + struct bar *a; + int b; +}; + +void +foo(void) { + struct bar *a; + + ((union foo)a).a; +} -- cgit v1.1