Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/util Convert the lint1 tests to atf.



details:   https://anonhg.NetBSD.org/src/rev/c079d67452f2
branches:  trunk
changeset: 756447:c079d67452f2
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Sun Jul 18 10:11:00 2010 +0000

description:
Convert the lint1 tests to atf.
Initial work from the GSoC 2008 project by Lukasz Strzygowski.

diffstat:

 tests/util/Makefile                                 |    4 +-
 tests/util/xlint/Makefile                           |    9 +
 tests/util/xlint/lint1/Makefile                     |   48 +++++++
 tests/util/xlint/lint1/d_alignof.c                  |    6 +
 tests/util/xlint/lint1/d_c99_complex_num.c          |    7 +
 tests/util/xlint/lint1/d_c99_for_loops.c            |   10 +
 tests/util/xlint/lint1/d_c99_func.c                 |    7 +
 tests/util/xlint/lint1/d_c99_recursive_init.c       |   13 ++
 tests/util/xlint/lint1/d_c99_struct_init.c          |   10 +
 tests/util/xlint/lint1/d_c99_union_init1.c          |    8 +
 tests/util/xlint/lint1/d_c99_union_init2.c          |    8 +
 tests/util/xlint/lint1/d_c99_union_init3.c          |    8 +
 tests/util/xlint/lint1/d_c9x_array_init.c           |    6 +
 tests/util/xlint/lint1/d_c9x_recursive_init.c       |   16 ++
 tests/util/xlint/lint1/d_cast_init.c                |   27 ++++
 tests/util/xlint/lint1/d_cast_init2.c               |    7 +
 tests/util/xlint/lint1/d_cast_lhs.c                 |    7 +
 tests/util/xlint/lint1/d_compound_literals1.c       |   11 +
 tests/util/xlint/lint1/d_compound_literals2.c       |   18 ++
 tests/util/xlint/lint1/d_constant_conv1.c           |    9 +
 tests/util/xlint/lint1/d_constant_conv2.c           |    9 +
 tests/util/xlint/lint1/d_cvt_in_ternary.c           |   13 ++
 tests/util/xlint/lint1/d_ellipsis_in_switch.c       |   11 +
 tests/util/xlint/lint1/d_gcc_compound_statements1.c |    7 +
 tests/util/xlint/lint1/d_gcc_compound_statements2.c |   14 ++
 tests/util/xlint/lint1/d_gcc_compound_statements3.c |   10 +
 tests/util/xlint/lint1/d_gcc_func.c                 |    7 +
 tests/util/xlint/lint1/d_gcc_variable_array_init.c  |    7 +
 tests/util/xlint/lint1/d_incorrect_array_size.c     |    3 +
 tests/util/xlint/lint1/d_long_double_int.c          |    7 +
 tests/util/xlint/lint1/d_nested_structs.c           |   21 +++
 tests/util/xlint/lint1/d_nolimit_init.c             |    4 +
 tests/util/xlint/lint1/d_packed_structs.c           |   35 +++++
 tests/util/xlint/lint1/d_shift_to_narrower_type.c   |   24 +++
 tests/util/xlint/lint1/d_type_conv1.c               |   11 +
 tests/util/xlint/lint1/d_type_conv2.c               |   11 +
 tests/util/xlint/lint1/d_type_conv3.c               |   10 +
 tests/util/xlint/lint1/d_zero_sized_arrays.c        |    3 +
 tests/util/xlint/lint1/t_integration.sh             |  126 ++++++++++++++++++++
 39 files changed, 570 insertions(+), 2 deletions(-)

diffs (truncated from 736 to 300 lines):

diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/Makefile
--- a/tests/util/Makefile       Sun Jul 18 10:04:03 2010 +0000
+++ b/tests/util/Makefile       Sun Jul 18 10:11:00 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.8 2010/07/13 21:13:30 jmmv Exp $
+# $NetBSD: Makefile,v 1.9 2010/07/18 10:11:00 jmmv Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=      ${TESTSBASE}/util
 
-TESTS_SUBDIRS=         awk bzip2 config cut df grep id m4 make mtree ps sdiff sh
+TESTS_SUBDIRS= awk bzip2 config cut df grep id m4 make mtree ps sdiff sh xlint
 
 TESTS_SH=      t_basename
 TESTS_SH+=     t_cp
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/Makefile Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2010/07/18 10:11:01 jmmv Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/util/xlint
+
+TESTS_SUBDIRS= lint1
+
+.include <bsd.test.mk>
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/Makefile   Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,48 @@
+# $NetBSD: Makefile,v 1.1 2010/07/18 10:11:01 jmmv Exp $
+
+NOMAN=         # defined
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/util/xlint/lint1
+
+TESTS_SH=      t_integration
+
+FILESDIR=      ${TESTSDIR}
+FILES=         d_c99_complex_num.c
+FILES+=                d_alignof.c
+FILES+=                d_c99_for_loops.c
+FILES+=                d_c99_func.c
+FILES+=                d_c99_recursive_init.c
+FILES+=                d_c99_struct_init.c
+FILES+=                d_c99_union_init1.c
+FILES+=                d_c99_union_init2.c
+FILES+=                d_c99_union_init3.c
+FILES+=                d_c9x_array_init.c
+FILES+=                d_c9x_recursive_init.c
+FILES+=                d_cast_init.c
+FILES+=                d_cast_init2.c
+FILES+=                d_cast_lhs.c
+FILES+=                d_compound_literals1.c
+FILES+=                d_compound_literals2.c
+FILES+=                d_constant_conv1.c
+FILES+=                d_constant_conv2.c
+FILES+=                d_cvt_in_ternary.c
+FILES+=                d_ellipsis_in_switch.c
+FILES+=                d_gcc_compound_statements1.c
+FILES+=                d_gcc_compound_statements2.c
+FILES+=                d_gcc_compound_statements3.c
+FILES+=                d_gcc_func.c
+FILES+=                d_gcc_variable_array_init.c
+FILES+=                d_incorrect_array_size.c
+FILES+=                d_long_double_int.c
+FILES+=                d_nested_structs.c
+FILES+=                d_nolimit_init.c
+FILES+=                d_packed_structs.c
+FILES+=                d_shift_to_narrower_type.c
+FILES+=                d_type_conv1.c
+FILES+=                d_type_conv2.c
+FILES+=                d_type_conv3.c
+FILES+=                d_zero_sized_arrays.c
+
+.include <bsd.test.mk>
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_alignof.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_alignof.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,6 @@
+/* __alignof__ */
+int
+main(void)
+{
+       return __alignof__(short);
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_complex_num.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_complex_num.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,7 @@
+double cabs(double _Complex);
+
+double cabs(double _Complex foo)
+{
+       double d = __real__ foo;
+       return d + 0.1fi;
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_for_loops.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_for_loops.c  Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,10 @@
+/* c99 for loops */
+extern void foo(int);
+
+int
+main(void)
+{
+       for (int i = 0; i < 10; i++)
+               foo(i);
+       return 0;
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_func.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_func.c       Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,7 @@
+/* C99 __func__ */
+
+void
+foo(const char *p) {
+       p = __func__;
+       foo(p);
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_recursive_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_recursive_init.c     Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,13 @@
+/* C99 recursive struct/union initialization */
+struct top {
+       int i;
+       char c;
+       union onion {
+               short us;
+               char uc;
+       }  u;
+       char *s;
+} c[] = { 
+       { .s = "foo", .c = 'b', .u = { .uc = 'c' } },
+       { .i = 1, .c = 'a', .u = { .us = 2 } },
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_struct_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_struct_init.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,10 @@
+/* C99 struct initialization */
+struct {
+       int i;
+       char *s;
+} c[] = { 
+       { .i =  2, },
+       { .s =  "foo" },
+       { .i =  1, .s = "bar" },
+       { .s =  "foo", .i = -1 },
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_union_init1.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_union_init1.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,8 @@
+/* C99 union initialization */
+union {
+       int i;
+       char *s;
+} c[] = { 
+       { i: 1 },
+       { s: "foo" }
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_union_init2.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_union_init2.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,8 @@
+/* C99 union initialization */
+union {
+       int i[10];
+       short s;
+} c[] = { 
+       { s: 2 },
+       { i: { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } },
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c99_union_init3.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c99_union_init3.c        Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,8 @@
+/* C99 union initialization */
+struct {
+       int i[10];
+       char *s;
+} c[] = { 
+       { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
+       "foo" },
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c9x_array_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c9x_array_init.c Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,6 @@
+/* C9X array initializers */
+int foo[256] = {
+       [2] = 1,
+       [3] = 2,
+       [4 ... 5] = 3
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_c9x_recursive_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_c9x_recursive_init.c     Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,16 @@
+/* C9X struct/union member init, with nested union and trailing member */
+union node {
+       void *next;
+       char *data;
+};
+struct foo {
+       int b;
+       union node n;
+       int c;
+};
+
+struct foo f = {
+       .b = 1,
+       .n = { .next = 0, },
+       .c = 1
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_cast_init.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_cast_init.c      Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,27 @@
+/* cast initialization */
+typedef unsigned char u_char;
+typedef unsigned int size_t;
+struct sockaddr_x25 {
+       u_char  x25_len;
+       u_char  x25_family;      
+       short   x25_net;         
+       char    x25_addr[16];    
+       struct  x25opts {
+               char    op_flags;        
+               char    op_psize;        
+               char    op_wsize;        
+               char    op_speed;        
+       } x25_opts;
+       short   x25_udlen;       
+       char    x25_udata[16];   
+};
+
+struct sockaddr_x25 x25_dgmask = {
+       (unsigned char)(unsigned char)(unsigned int)(unsigned long)(&((( struct sockaddr_x25  *)0)->x25_udata[1])) ,     
+       0,               
+       0,               
+       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},        
+       {0, 0, 0, 0},            
+       -1,              
+       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},        
+};
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_cast_init2.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_cast_init2.c     Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,7 @@
+/* cast initialization as the rhs of a - operand */
+struct sockaddr_dl {
+       char sdl_data[2];
+};
+
+int             npdl_datasize = sizeof(struct sockaddr_dl) -
+((int) ((unsigned long)&((struct sockaddr_dl *) 0)->sdl_data[0]));
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_cast_lhs.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_cast_lhs.c       Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,7 @@
+/* pointer casts are valid lhs lvalues */
+struct sockaddr { };
+void
+foo() {
+    unsigned long p = 6;
+    ((struct sockaddr *)p) = 0;
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_compound_literals1.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_compound_literals1.c     Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,11 @@
+/* compound literals */
+
+struct p {
+       short a, b, c, d;
+};
+
+foo()
+{
+       struct p me = (struct p) {1, 2, 3, 4};
+       me.a = me.b;
+}
diff -r 8749dd9d2e0e -r c079d67452f2 tests/util/xlint/lint1/d_compound_literals2.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/xlint/lint1/d_compound_literals2.c     Sun Jul 18 10:11:00 2010 +0000
@@ -0,0 +1,18 @@
+/* compound literals */
+
+struct p {
+       short a, b, c, d;



Home | Main Index | Thread Index | Old Index