[Lsb-messages] /var/www/bzr/lsb/devel/t2c-runtime-tests r36: cleanup for bug 4062

Mats Wichmann mats at linuxfoundation.org
Mon Feb 2 17:11:36 UTC 2015


------------------------------------------------------------
revno: 36
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: t2c-runtime-tests
timestamp: Mon 2015-02-02 10:11:36 -0700
message:
  cleanup for bug 4062
modified:
  runtime-t2c/libc-t2c/src/util/util.t2c
  runtime-t2c/package/Makefile
-------------- next part --------------
=== modified file 'runtime-t2c/libc-t2c/src/util/util.t2c'
--- a/runtime-t2c/libc-t2c/src/util/util.t2c	2010-01-29 01:53:05 +0000
+++ b/runtime-t2c/libc-t2c/src/util/util.t2c	2015-02-02 17:11:36 +0000
@@ -18,6 +18,7 @@
 #include <search.h>
 #include <wordexp.h>
 #define MAX 5
+#define LINESZ 2
 #define FILE "tmpfile.txt"
 
 extern int getdate_err;
@@ -26,10 +27,11 @@
 int fd1, fd2, fd3, retval, l, i;
 ENTRY it, *f_item;
 void *item, *rootp = NULL;
-size_t sz = 5;
-char k[MAX][2] = {"a\0", "b\0", "c\0", "d\0", "e\0"};;
+size_t sz = MAX;
+/* make 'k' one bigger to leave room for lsearch to add one */
+char k[MAX+1][LINESZ] = {"a", "b", "c", "d", "e", "0"};
 size_t dat[MAX] = {25, 120, 34, 47, 99};
-char new[2][2] = {"g\0", "h\0"};
+char new[2][LINESZ] = {"g", "h"};
 
 void prnt(const void *ptr, VISIT order, int level)
 {
@@ -91,7 +93,7 @@
      */
 
     char buf[4];
-    char b[4]=": 0\0";
+    char b[4]=": 0";
 
     fd1=dup(2);
     close(2);
@@ -142,7 +144,7 @@
      */
 
     char buf[26];
-    char b[26]=": Operation not permitted\0";
+    char b[26]=": Operation not permitted";
 
     fd1=dup(2);
     close(2);
@@ -247,7 +249,7 @@
      */
 
     char buf[8];
-    char b[8]="Success\0";
+    char b[8]="Success";
 
     fd1=dup(2);
     close(2);
@@ -786,8 +788,8 @@
      * return a pointer to it
      */
 
-    item = lfind(k[3], k, &sz, sizeof("a\0"), (int (*)(const void *, const void *)) strcmp);
-    REQ("lfind.01", "lfind failed even for valid scenario", strcmp(item, "d\0") == 0);
+    item = lfind(k[3], k, &sz, LINESZ, (int (*)(const void *, const void *)) strcmp);
+    REQ("lfind.01", "lfind failed even for valid scenario", strcmp(item, "d") == 0);
 
 </CODE>
 
@@ -818,7 +820,7 @@
      * [If the searched element is not found, lfind returns NULL]
      */
 
-    item = lfind(new[1], k, &sz, sizeof("a\0"), (int (*)(const void *, const void *)) strcmp);
+    item = lfind(new[1], k, &sz, LINESZ, (int (*)(const void *, const void *)) strcmp);
     REQ("lfind.01", "lfind failed for returning null pointer", item == NULL);
 
 </CODE>
@@ -849,8 +851,8 @@
      * pointer into the table for the matching entry
      */
 
-    item = lsearch(k[3], k, &sz, sizeof("a\0"), (int (*)(const void *, const void *)) strcmp);
-    REQ("lsearch.01", "lsearch failed even for valid scenario", strcmp(item, "d\0") == 0);
+    item = lsearch(k[3], k, &sz, LINESZ, (int (*)(const void *, const void *)) strcmp);
+    REQ("lsearch.01", "lsearch failed even for valid scenario", strcmp(item, "d") == 0);
 
 </CODE>
 
@@ -882,8 +884,8 @@
      * table.]
      */
 
-    item = lsearch(new[1], k, &sz, sizeof("a\0"), (int (*)(const void *, const void *)) strcmp);
-    REQ("lsearch.02", "lsearch failed for returning pointer to a newly added element", ((strcmp(item, "h\0") == 0) && (sz == 6)));
+    item = lsearch(new[1], k, &sz, LINESZ, (int (*)(const void *, const void *)) strcmp);
+    REQ("lsearch.02", "lsearch failed for returning pointer to a newly added element", ((strcmp(item, "h") == 0) && (sz == MAX+1)));
 
 </CODE>
 
@@ -1022,7 +1024,7 @@
 	ABORT_TEST_PURPOSE("BST creation failed");
 
     item = tfind((void *)k[2], (void **)&rootp, (int (*)(const void *, const void *)) strcmp);
-    REQ("tfind.01", "tfind failed for returning a pointer to the searched node", strcmp((char *) *((size_t *)(item)), "c\0") == 0);
+    REQ("tfind.01", "tfind failed for returning a pointer to the searched node", strcmp((char *) *((size_t *)(item)), "c") == 0);
 
 </CODE>
 
@@ -1128,7 +1130,7 @@
 	ABORT_TEST_PURPOSE("BST creation failed");
 
     item = tsearch((void *)k[2], (void **)&rootp, (int (*)(const void *, const void *)) strcmp);
-    REQ("tsearch.01", "tsearch failed for returning a pointer to the searched node", strcmp((char *) *((size_t *)(item)), "c\0") == 0);
+    REQ("tsearch.01", "tsearch failed for returning a pointer to the searched node", strcmp((char *) *((size_t *)(item)), "c") == 0);
 
 </CODE>
 
@@ -1198,7 +1200,7 @@
 	ABORT_TEST_PURPOSE("BST creation failed");
 
     item = tsearch((void *)new[1], (void **)&rootp, (int (*)(const void *, const void *)) strcmp);
-    REQ("tsearch.03", "tsearch failed for adding a new node", strcmp((char *) *((size_t *)(item)), "h\0") == 0);
+    REQ("tsearch.03", "tsearch failed for adding a new node", strcmp((char *) *((size_t *)(item)), "h") == 0);
 
 </CODE>
 

=== modified file 'runtime-t2c/package/Makefile'
--- a/runtime-t2c/package/Makefile	2014-09-26 15:38:54 +0000
+++ b/runtime-t2c/package/Makefile	2015-02-02 17:11:36 +0000
@@ -1,5 +1,5 @@
 PACKAGE=lsb-test-core-t2c
-VERSION=5.0.0
+VERSION=5.0.1
 BUILDNO=1
 
 # for pkgchk



More information about the lsb-messages mailing list