]> granicus.if.org Git - check/commitdiff
Applied a slightly modified version of a patch from
authorneo23 <neo23@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 10 Apr 2002 11:11:48 +0000 (11:11 +0000)
committerneo23 <neo23@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Wed, 10 Apr 2002 11:11:48 +0000 (11:11 +0000)
Neil Spring <nspring@cs.washington.edu> that declares strings as
const where applicable. It also changes our CFLAGS to be much
stricter and removes the warnings introduced by -Wwrite-strings.
This allows building other check tests with -Wwrite-strings
without heaping gobs of compiler warnings.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@127 64e312b2-a51f-0410-8e61-82d0ca0eb02a

21 files changed:
check/AUTHORS
check/NEWS
check/configure.in
check/src/check.c
check/src/check.h.in
check/src/check_error.c
check/src/check_error.h
check/src/check_impl.h
check/src/check_log.c
check/src/check_msg.c
check/src/check_msg.h
check/src/check_pack.c
check/src/check_run.c
check/src/check_str.c
check/src/list.c
check/src/list.h
check/tests/check_check_fixture.c
check/tests/check_check_fork.c
check/tests/check_check_master.c
check/tests/check_check_pack.c
check/tests/check_list.c

index a57180fbeaef819f37aa8af06dd891f08a066770..d9e48b277d5562a5ccd7ec0943962257e8e243ee 100644 (file)
@@ -1,10 +1,12 @@
-Primary maintainer
-arien_malec@yahoo.com
+Original author:
+Arien Malec <arien_malec@yahoo.com>
 
-Check 0.8.0
+Current maintainer:
+Sven Neumann <sven@convergence.de>
 
 Patches:
 Bernhard Reiter (configure issues)
+Neil Spring (const fixes)
 
 Design suggestions:
 Fred Drake (checked fixture functions)
index 83e191191b0d9a2d605ad5dabec3dd3d91c0ee3c..7af98afe296d5a164de4de150fc422b68fb7be3d 100644 (file)
@@ -1,5 +1,10 @@
-Wed Oct 24, 2001:
-Released Check 0.8.0
+Sat Mar 2, 2001: Released Check 0.8.1
+
+Changed license to LGPL.
+Fixed bug in running checked setup in nofork mode.
+
+
+Wed Oct 24, 2001: Released Check 0.8.0
 
 Support running in a nofork mode. Defined a checked fixture as well as
 an unchecked fixture, support failing in checked and uncheck fixture
@@ -24,8 +29,8 @@ Fixed the Autoconf Lyx check in acinclude.m4 so that configure works
 on Solaris systems (and hopefully others), and cleaned up a minor
 problem in Debian packaging.
 
-Fri Aug 17, 2001:
-Released Check 0.7.2
+
+Fri Aug 17, 2001: Released Check 0.7.2
 
 Automated RPM packaging, and included debian packaging. The makefiles
 now has an rpm target (the RPMFLAGS variable can be set to add
@@ -47,15 +52,14 @@ supports linuxdoc (but it's not clear to me how to test that for
 sure).
 
 
-Wed Jul 30, 2001:
-Released Check 0.7.1
+Wed Jul 30, 2001: Released Check 0.7.1
 
 Reorganized printing and logging functions to allow for a less
 primitive logging function. Logging is now documented in the tutorial
 documentation.
 
-Wed Jul 11, 2001:
-Released Check 0.7.0
+
+Wed Jul 11, 2001: Released Check 0.7.0
 
 Included a primitive logging function (at the moment, it only prints a
 copy of the CRVERBOSE output to the log file), added the ability for
@@ -69,9 +73,7 @@ release should include API docs and improved logging, if nothing else
 comes up...
 
 
-Wed Jun 27, 2001:
-
-Released Check 0.6.1
+Wed Jun 27, 2001: Released Check 0.6.1
 
 Bug fix for srunner_failures (bad version actually returned all
 results), added srunner_results to do what srunner_failures used to
@@ -82,12 +84,13 @@ srunner_nfailed to srunner_ntests_failed, to harmonized better with
 new function srunner_ntests_run. This unfortunately may break some
 unit tests slightly -- that's why the major release number is 0 :-)
 
-Thu Jun 21, 2001:
-Released Check 0.6.0
+
+Thu Jun 21, 2001: Released Check 0.6.0
 
 Features improved unit test reporting options, more complete unit
 tests, and end-to-end test, and a full API into TestResults
 
+
 Check 0.5.2
 Minor edits
 Check 0.5.1
index 56a903f9386c24b3cdf54efc9f887044230de3ab..d8553d52f10add9541ef482b94e7b8ea718e2549 100644 (file)
@@ -30,7 +30,7 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_RANLIB
 if test -n "$GCC"; then
-   CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes"
+   CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings"
 fi
 CK_LYX_LINUXDOC([have_lyx="yes"],[have_lyx="no"])
 AC_CHECK_PROG(have_sgmltools,sgml2html,yes)
index 23163950db00cf5e74985be9ce619bedfe6fb430..670af513ac2d3127f909b1fcb19f010a9a4ac65a 100644 (file)
@@ -37,7 +37,7 @@ static void tcase_add_fixture (TCase *tc, SFun setup, SFun teardown,
                               int ischecked);
 static void tr_init (TestResult *tr);
 
-Suite *suite_create (char *name)
+Suite *suite_create (const char *name)
 {
   Suite *s;
   s = emalloc (sizeof(Suite)); /* freed in suite_free */
@@ -61,7 +61,7 @@ void suite_free (Suite *s)
   free(s);
 }
 
-TCase *tcase_create (char *name)
+TCase *tcase_create (const char *name)
 {
   TCase *tc = emalloc (sizeof(TCase)); /*freed in tcase_free */
   if (name == NULL)
@@ -101,7 +101,7 @@ void suite_add_tcase (Suite *s, TCase *tc)
   list_add_end (s->tclst, tc);
 }
 
-void _tcase_add_test (TCase *tc, TFun fn, char *name)
+void _tcase_add_test (TCase *tc, TFun fn, const char *name)
 {
   TF * tf;
   if (tc == NULL || fn == NULL || name == NULL)
@@ -150,18 +150,18 @@ static void tcase_add_fixture (TCase *tc, SFun setup, SFun teardown,
   }
 }
 
-void tcase_fn_start (char *fname, char *file, int line)
+void tcase_fn_start (const char *fname, const char *file, int line)
 {
   send_ctx_info (get_send_key(),CK_CTX_TEST);
   send_loc_info (get_send_key(),file, line);
 }
 
-void _mark_point (char *file, int line)
+void _mark_point (const char *file, int line)
 {
   send_loc_info (get_send_key(), file, line);
 }
 
-void _fail_unless (int result, char *file, int line, char * msg)
+void _fail_unless (int result, const char *file, int line, const char * msg)
 {
   if (msg == NULL)
     eprintf ("_fail_unless() called with NULL msg",__FILE__,__LINE__);
@@ -284,11 +284,13 @@ static void tr_init (TestResult *tr)
   tr->ctx = -1;
   tr->line = -1;
   tr->rtype = -1;
-  tr->msg = tr->file = tr->tcname = NULL;
+  tr->msg = NULL;
+  tr->file = NULL;
+  tr->tcname = NULL;
 }
 
 
-char *tr_msg (TestResult *tr)
+const char *tr_msg (TestResult *tr)
 {
   return tr->msg;
 }
@@ -298,7 +300,7 @@ int tr_lno (TestResult *tr)
   return tr->line;
 }
 
-char *tr_lfile (TestResult *tr)
+const char *tr_lfile (TestResult *tr)
 {
   return tr->file;
 }
@@ -313,7 +315,7 @@ enum ck_result_ctx tr_ctx (TestResult *tr)
   return tr->ctx;
 }
 
-char *tr_tcname (TestResult *tr)
+const char *tr_tcname (TestResult *tr)
 {
   return tr->tcname;
 }
index e433ab715bf701de6bcd916845828575bc43242d..142989c691e62086ce791a997d93ba87ff5733b5 100644 (file)
@@ -1,3 +1,4 @@
+/*-*- mode:C; -*- */
 /*
  * Check: a unit test framework for C
  * Copyright (C) 2001, 2002, Arien Malec
@@ -89,7 +90,7 @@ typedef struct Suite Suite;
  
 /* Creates a test suite with the given name
 */
-Suite *suite_create (char *name);
+Suite *suite_create (const char *name);
 
 /* Free a test suite (For the moment, this also frees all contained
   test cases) */
@@ -99,7 +100,7 @@ void suite_free (Suite *s);
 void suite_add_tcase (Suite *s, TCase *tc);
 
 /* Create a test case */
-TCase *tcase_create (char *name);
+TCase *tcase_create (const char *name);
 
 /* Free a test case
 
@@ -115,7 +116,7 @@ void tcase_free (TCase *tc);
 
 /* Add a test function to a test case
   (function version -- use this when the macro won't work */
-void _tcase_add_test (TCase *tc, TFun tf, char *fname);
+void _tcase_add_test (TCase *tc, TFun tf, const char *fname);
 
 /* Add unchecked fixture setup/teardown functions to a test case
 
@@ -150,7 +151,7 @@ void tcase_add_checked_fixture (TCase *tc, SFun setup, SFun teardown);
   
  
 /* Internal function to mark the start of a test function */
-void tcase_fn_start (char *fname, char *file, int line);
+void tcase_fn_start (const char *fname, const char *file, int line);
 
 /* Start a unit test with START_TEST(unit_name), end with END_TEST
    One must use braces within a START_/END_ pair to declare new variables */
@@ -169,7 +170,7 @@ static void __testname (void)\
  _fail_unless(expr,__FILE__,__LINE__, msg ? msg : "Assertion '"#expr"' failed")
 
 /* Non macro version of #fail_unless, with more complicated interface */
-void _fail_unless (int result, char *file, int line, char *msg);
+void _fail_unless (int result, const char *file, int line, const char *msg);
 
 /* Always fail */
 #define fail(msg) _fail_unless(0,__FILE__,__LINE__,msg)
@@ -180,7 +181,7 @@ void _fail_unless (int result, char *file, int line, char *msg);
 #define mark_point() _mark_point(__FILE__,__LINE__)
 
 /* Non macro version of #mark_point */
-void _mark_point (char *file, int line);
+void _mark_point (const char *file, int line);
 
 /* Result of a test */
 enum test_result {
@@ -218,13 +219,13 @@ int tr_rtype (TestResult *tr);
 /* Context in which the result occurred */ 
 enum ck_result_ctx tr_ctx (TestResult *tr); 
 /* Failure message */
-char *tr_msg (TestResult *tr);
+const char *tr_msg (TestResult *tr);
 /* Line number at which failure occured */
 int tr_lno (TestResult *tr);
 /* File name at which failure occured */
-char *tr_lfile (TestResult *tr);
+const char *tr_lfile (TestResult *tr);
 /* Test case in which unit test was run */
-char *tr_tcname (TestResult *tr);
+const char *tr_tcname (TestResult *tr);
 
 /* Creates an SRunner for the given suite */
 SRunner *srunner_create (Suite *s);
@@ -283,7 +284,7 @@ void srunner_print (SRunner *sr, enum print_output print_mode);
   done immediatly after SRunner creation, and the log file can't be
   changed after being set.
  */
-void srunner_set_log (SRunner *sr, char *fname);
+void srunner_set_log (SRunner *sr, const char *fname);
 
 /* Does the SRunner have a log file?
 */
@@ -291,7 +292,7 @@ int srunner_has_log (SRunner *sr);
 
 /* Return the name of the log file, or NULL if none
 */
-char *srunner_log_fname (SRunner *sr);
+const char *srunner_log_fname (SRunner *sr);
 
 /* Control forking */
 enum fork_status {
index 3cf8c26e3ff2d084a88aa82b793acf7b59da52f5..41174c68891b2bf1aec8f4ea0df8985e0cfc8e35 100644 (file)
@@ -26,7 +26,7 @@
 #include "check_error.h"
 
 
-void eprintf (char *fmt, char *file, int line, ...)
+void eprintf (const char *fmt, const char *file, int line, ...)
 {
   va_list args;
   fflush(stderr);
index a47a7f60715854d18456b5ca32483cf242b4ffef..2e1e211bea24f364b085692d569bed7aa529204c 100644 (file)
@@ -25,7 +25,7 @@
 
 /* Print error message and die
    If fmt ends in colon, include system error information */
-void eprintf (char *fmt, char *file, int line,...);
+void eprintf (const char *fmt, const char *file, int line,...);
 /* malloc or die */
 void *emalloc(size_t n);
 void *erealloc(void *, size_t n);
index dfbdca66c59268319d676867c9f7fb0cd47f1dfa..f6f0973a54497540d51fbaee85e7679daf128f1f 100644 (file)
@@ -39,11 +39,11 @@ enum {
 
 typedef struct TF {
   TFun fn;
-  char *name;
+  const char *name;
 } TF;
 
 struct Suite {
-  char *name;
+  const char *name;
   List *tclst; /* List of test cases */
 };
 
@@ -54,7 +54,7 @@ typedef struct Fixture
 } Fixture;
 
 struct TCase {
-  char *name;
+  const char *name;
   List *tflst; /* list of test functions */
   List *unch_sflst;
   List *unch_tflst;
@@ -73,7 +73,7 @@ struct TestResult {
   enum ck_result_ctx ctx;     /* When the result occurred */
   char *file;    /* File where the test occured */
   int line;      /* Line number where the test occurred */
-  char *tcname;  /* Test case that generated the result */
+  const char *tcname;  /* Test case that generated the result */
   char *msg;     /* Failure message */
 };
 
@@ -102,7 +102,7 @@ struct SRunner {
   List *slst; /* List of Suite objects */
   TestStats *stats; /* Run statistics */
   List *resultlst; /* List of unit test results */
-  char *log_fname; /* name of log file */
+  const char *log_fname; /* name of log file */
   List *loglst; /* list of Log objects */
   enum fork_status fstat; /* controls if suites are forked or not
                             NOTE: Don't use this value directly,
index f01d1f7d2200439d8b63f4cb32443be7e55976dd..8f127dc08a3eae01bd576eb1d05ca52f8571cd46 100644 (file)
@@ -30,7 +30,7 @@
 
 static void srunner_send_evt (SRunner *sr, void *obj, enum cl_event evt);
 
-void srunner_set_log (SRunner *sr, char *fname)
+void srunner_set_log (SRunner *sr, const char *fname)
 {
   if (sr->log_fname)
     return;
@@ -42,7 +42,7 @@ int srunner_has_log (SRunner *sr)
   return sr->log_fname != NULL;
 }
 
-char *srunner_log_fname (SRunner *sr)
+const char *srunner_log_fname (SRunner *sr)
 {
   return sr->log_fname;
 }
index b1e9d3789ed95366c1012382992253f5511c335c..ca7494fe18d4bdab19019a46ff1d60d2f9eed579 100644 (file)
@@ -60,24 +60,24 @@ static TestResult *construct_test_result (RcvMsg *rmsg, int waserror);
 static void tr_set_loc_by_ctx (TestResult *tr, enum ck_result_ctx ctx,
                               RcvMsg *rmsg);
 
-void send_failure_info (MsgKey *key, char *msg)
+void send_failure_info (MsgKey *key, const char *msg)
 {
   FailMsg fmsg;
   Pipe *p;
 
-  fmsg.msg = msg;
+  fmsg.msg = (char *) msg;
   p = get_pipe_by_key(key);
   if (p == NULL)
     eprintf("Couldn't find pipe with key %d",__FILE__, __LINE__, key);
   ppack(p->sendfd, CK_MSG_FAIL, &fmsg);
 }
 
-void send_loc_info (MsgKey *key, char * file, int line)
+void send_loc_info (MsgKey *key, const char * file, int line)
 {
   LocMsg lmsg;
   Pipe *p;
 
-  lmsg.file = file;
+  lmsg.file = (char *) file;
   lmsg.line = line;
   p = get_pipe_by_key(key);
   if (p == NULL)
index 75d0936255253b3335e4f0b3acab1c3696c683ed..cde73924f1c4137a2f9b48572054f5cde61552d8 100644 (file)
@@ -26,9 +26,9 @@ typedef struct MsgKey MsgKey;
 
 /* Functions implementing messaging during test runs */
 
-void send_failure_info (MsgKey *key, char *msg);
-void send_loc_info (MsgKey *key, char *file, int line);
-void send_ctx_info (MsgKey *key,enum ck_result_ctx ctx);
+void send_failure_info (MsgKey *key, const char *msg);
+void send_loc_info (MsgKey *key, const char *file, int line);
+void send_ctx_info (MsgKey *key, enum ck_result_ctx ctx);
 
 TestResult *receive_test_result (MsgKey *key, int waserror);
 
index 7fff8c5dd76184cfaa6df7cfb0a91b83019b2119..0ec7c1e974855a1c60ec558a279cf65dffe4497c 100644 (file)
@@ -33,7 +33,7 @@
 
 static void pack_int (char **buf, int val);
 static int upack_int (char **buf);
-static void pack_str (char **buf, char *str);
+static void pack_str (char **buf, const char *str);
 static char *upack_str (char **buf);
 
 static void pack_ctx (char **buf, void *msg);
@@ -43,14 +43,14 @@ static void upack_ctx (char **buf, void *msg);
 static void upack_loc (char **buf, void *msg);
 static void upack_fail (char **buf, void *msg);
 
-static void check_type (int type, char *file, int line);
+static void check_type (int type, const char *file, int line);
 static enum ck_msg_type upack_type (char **buf);
 static void pack_type (char **buf, enum ck_msg_type type);
 
 static int read_buf (int fdes, char **buf);
 static int get_result (char *buf, RcvMsg *rmsg);
 static void rcvmsg_update_ctx(RcvMsg *rmsg, enum ck_result_ctx ctx);
-static void rcvmsg_update_loc(RcvMsg *rmsg, char *file, int line);
+static void rcvmsg_update_loc(RcvMsg *rmsg, const char *file, int line);
 static RcvMsg *rcvmsg_create(void);
 
 typedef void (*pfun) (char **, void *);
@@ -129,7 +129,7 @@ static int upack_int (char **buf)
   return val;
 }
 
-static void pack_str (char **buf, char *val)
+static void pack_str (char **buf, const char *val)
 {
   int strsz;
   int n;
@@ -221,7 +221,7 @@ static void upack_fail (char **buf, void *msg)
   fmsg->msg = upack_str(buf);
 }
 
-static void check_type (int type, char *file, int line)
+static void check_type (int type, const char *file, int line)
 {
   if (type >= CK_MSG_LAST)
     eprintf ("%s:%d:Bad message type arg", file, line);
@@ -332,7 +332,7 @@ static void rcvmsg_update_ctx(RcvMsg *rmsg, enum ck_result_ctx ctx)
   rmsg->lastctx = ctx;
 }
 
-static void rcvmsg_update_loc (RcvMsg *rmsg, char *file, int line)
+static void rcvmsg_update_loc (RcvMsg *rmsg, const char *file, int line)
 {
   int flen = strlen(file);
   
index 25acb8e2440fedbb4bf19171d3b03ed478e212ad..9852382fc675d450064e37d57e5ccca4769d5c5c 100644 (file)
@@ -60,8 +60,8 @@ static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc);
 static void srunner_add_failure (SRunner *sr, TestResult *tf);
 static TestResult *tcase_run_tfun_fork (TCase *tc, TF *tf);
 static TestResult *tcase_run_tfun_nofork (TCase *tc, TF *tf);
-static TestResult *receive_result_info_fork (char *tcname, int status);
-static TestResult *receive_result_info_nofork (char *tcname);
+static TestResult *receive_result_info_fork (const char *tcname, int status);
+static TestResult *receive_result_info_nofork (const char *tcname);
 static void set_fork_info (TestResult *tr, int status);
 static void set_nofork_info (TestResult *tr);
 static char *signal_msg (int sig);
@@ -247,7 +247,7 @@ static void srunner_run_tcase (SRunner *sr, TCase *tc)
   }
 }
 
-static TestResult *receive_result_info_fork (char *tcname, int status)
+static TestResult *receive_result_info_fork (const char *tcname, int status)
 {
   TestResult *tr;
 
@@ -260,7 +260,7 @@ static TestResult *receive_result_info_fork (char *tcname, int status)
   return tr;
 }
 
-static TestResult *receive_result_info_nofork (char *tcname)
+static TestResult *receive_result_info_nofork (const char *tcname)
 {
   TestResult *tr;
 
index c7803be8fe8fbac31b215bb13722c86b4eb0b953..1d42822ed2664a16552a8dcb2a47606bcba650eb 100644 (file)
 #include "check_impl.h"
 #include "check_str.h"
 
-static char *tr_type_str (TestResult *tr);
+static const char *tr_type_str (TestResult *tr);
 static int percent_passed (TestStats *t);
 
 char *tr_str (TestResult *tr) 
 {
-  char *exact_msg;
+  const char *exact_msg;
   char *rstr;
   
   exact_msg = (tr->rtype == CK_ERROR) ? "(after this point) ": "";
@@ -59,9 +59,9 @@ char *sr_stat_str (SRunner *sr)
 }
 
 
-static char *tr_type_str (TestResult *tr)
+static const char *tr_type_str (TestResult *tr)
 {
-  char *str = NULL;
+  const char *str = NULL;
   if (tr->ctx == CK_CTX_TEST) {
     if (tr->rtype == CK_PASS)
       str = "P";
index cd6c6f3f18847eb1a77558f1c1984d7cff56cd14..80545017c21f7df7d135cb4fd75f42d40122737a 100644 (file)
@@ -32,7 +32,7 @@ struct List {
   int max_elts;
   int current; /* pointer to the current node */
   int last; /* pointer to the node before END */
-  void **data;
+  const void **data;
 };
 
 static void maybe_grow (List *lp)
@@ -54,7 +54,7 @@ List *list_create (void)
   return lp;
 }
 
-void list_add_end (List *lp, void *val)
+void list_add_end (List *lp, const void *val)
 {
   if (lp == NULL)
     return;
@@ -97,7 +97,7 @@ void *list_val (List *lp)
   if (lp->current == -1 || lp->current > lp->last)
     return NULL;
   
-  return lp->data[lp->current];
+  return (void*) lp->data[lp->current];
 }
 
 void list_advance (List *lp)
index 11e0f5dee5e05371ec8e191cf5d21c151f74c269..738e2fa2f523265d4331dd881ece950210214825 100644 (file)
@@ -35,7 +35,7 @@ void list_front(List *lp);
 
 /* Add a value to the end of the list,
    positioning newly added value as current value */
-void list_add_end (List *lp, void *val);
+void list_add_end (List *lp, const void *val);
 
 /* Give the value of the current node */
 void *list_val (List * lp);
index 6e696b167abeb06f066e8a1a44b9440f4b758c54..795a882fb47efdc1dd8b68153c07ea1848a41aa5 100644 (file)
@@ -48,7 +48,7 @@ END_TEST
 START_TEST(test_print_counts)
 {
   char *srstat = sr_stat_str(fixture_sr);
-  char *exp = "0%: Checks: 0, Failures: 1, Errors: 0";
+  const char *exp = "0%: Checks: 0, Failures: 1, Errors: 0";
 
   fail_unless(strcmp(srstat, exp) == 0,
              "SRunner stat string incorrect with setup failure");
@@ -59,7 +59,7 @@ START_TEST(test_setup_failure_msg)
 {
   TestResult **tra;
   char *trm;
-  char *trmexp = "check_check_fixture.c:12:S:Core: Test failure in fixture";
+  const char *trmexp = "check_check_fixture.c:12:S:Core: Test failure in fixture";
 
   tra = srunner_failures(fixture_sr);
   trm = tr_str(tra[0]);
index 9f4e34006e937795033171274bc264dd60e2fa4d..3134a2f87c014a20d15f54edf88817ebd79e993f 100644 (file)
@@ -89,7 +89,7 @@ END_TEST
 
 START_TEST(test_env)
 {
-  putenv("CK_FORK=no");
+  putenv((char *) "CK_FORK=no");
   fail_unless(srunner_fork_status(fork_dummy_sr) == CK_NOFORK,
              "Fork status does not obey environment variable");
 }
@@ -97,7 +97,7 @@ END_TEST
 
 START_TEST(test_env_and_set)
 {
-  putenv("CK_FORK=no");
+  putenv((char *) "CK_FORK=no");
   srunner_set_fork_status(fork_dummy_sr, CK_FORK);  
   fail_unless(srunner_fork_status(fork_dummy_sr) == CK_FORK,
              "Explicit setting of fork status should override env");
index acb10a959723f6933e48c6148e8ffe72218af14a..1f1e71fc4b170ae77034f2724f2cc93cd3a91045 100644 (file)
@@ -26,7 +26,7 @@ END_TEST
 START_TEST(test_check_failure_msgs)
 {
   int i;
-  char *msgar[] = {
+  const char *msgar[] = {
     "Failure expected",
     "Early exit with return value 1",
     /*    "Test passed", */
@@ -40,7 +40,7 @@ START_TEST(test_check_failure_msgs)
     "We failed"};
 
   for (i = 0; i < sub_nfailed; i++) {
-    char *msg;   
+    const char *msg;   
     msg = tr_msg(tr_fail_array[i]);
     if (strcmp (msg, msgar[i]) != 0) {
       char *emsg = malloc (MAXSTR);
@@ -116,7 +116,7 @@ END_TEST
 START_TEST(test_check_failure_tcnames)
 {
   int i;
-  char *tcnamearr[] = {
+  const char *tcnamearr[] = {
     "Simple Tests",
     "Simple Tests",
     "Simple Tests",
@@ -130,7 +130,7 @@ START_TEST(test_check_failure_tcnames)
     "Core"};
   
   for (i = 0; i < sub_nfailed; i++) {
-    char *tcname;   
+    const char *tcname;   
     tcname = tr_tcname(tr_all_array[i]);
     if (strcmp (tcname, tcnamearr[i]) != 0) {
       char *emsg = malloc (MAXSTR);
@@ -146,7 +146,7 @@ END_TEST
 START_TEST(test_check_all_msgs)
 {
   int i;
-  char *msgar[] = {
+  const char *msgar[] = {
     "Failure expected",
     "Early exit with return value 1",
     "Passed",
@@ -160,7 +160,7 @@ START_TEST(test_check_all_msgs)
     "We failed"};
 
   for (i = 0; i < sub_ntests; i++) {
-    char *msg;   
+    const char *msg;   
     msg = tr_msg(tr_all_array[i]);
     if (strcmp (msg, msgar[i]) != 0) {
       char *emsg = malloc (MAXSTR);
index e36d05ed39b050d6486304494c6dd43b6122b530..c3607159901a095030e1c8bc4a154c56db412f36 100644 (file)
@@ -17,10 +17,11 @@ START_TEST(test_pack_fmsg)
 
   fmsg = emalloc (sizeof(FailMsg));
   buf = emalloc (CK_MAXMSGBUF);
-  fmsg->msg = "Hello, world!";
 
+  fmsg->msg = (char *) "Hello, world!";
   pack (CK_MSG_FAIL, buf, fmsg);
-  fmsg->msg = "";
+
+  fmsg->msg = (char *) "";
   upack (buf, fmsg, &type);
 
   fail_unless (type == CK_MSG_FAIL,
@@ -49,11 +50,11 @@ START_TEST(test_pack_loc)
 
   lmsg = emalloc (sizeof(LocMsg));
   buf = emalloc (CK_MAXMSGBUF);
-  lmsg->file = "abc123.c";
+  lmsg->file = (char *) "abc123.c";
   lmsg->line = 125;
 
   pack (CK_MSG_LOC, buf, lmsg);
-  lmsg->file = "";
+  lmsg->file = NULL;
   lmsg->line = 0;
   upack (buf, lmsg, &type);
 
@@ -161,9 +162,9 @@ START_TEST(test_pack_fail_limit)
   enum ck_msg_type type;
 
   buf = emalloc (CK_MAXMSGBUF);
-  fmsg.msg = "";
+  fmsg.msg = (char *) "";
   pack(CK_MSG_FAIL,buf,&fmsg);
-  fmsg.msg = "abc";
+  fmsg.msg = (char *) "abc";
   upack(buf,&fmsg,&type);
   fail_unless (strcmp(fmsg.msg, "") == 0, "Empty string not handled properly");
   free(fmsg.msg);
@@ -181,10 +182,10 @@ START_TEST(test_pack_loc_limit)
   enum ck_msg_type type;
 
   buf = emalloc (CK_MAXMSGBUF);
-  lmsg.file = "";
+  lmsg.file = (char *) "";
   lmsg.line = 0;
   pack(CK_MSG_LOC,buf,&lmsg);
-  lmsg.file = "abc";
+  lmsg.file = (char *) "abc";
   upack(buf,&lmsg,&type);
   fail_unless (strcmp(lmsg.file, "") == 0,
               "Empty string not handled properly");
@@ -204,9 +205,9 @@ START_TEST(test_ppack)
   RcvMsg *rmsg;
 
   cmsg.ctx = CK_CTX_TEST;
-  lmsg.file = "abc123.c";
+  lmsg.file = (char *) "abc123.c";
   lmsg.line = 10;
-  fmsg.msg = "oops";
+  fmsg.msg = (char *) "oops";
   pipe(filedes);
   ppack(filedes[1],CK_MSG_CTX, &cmsg);
   ppack(filedes[1],CK_MSG_LOC, &lmsg);
@@ -240,9 +241,9 @@ START_TEST(test_ppack_noctx)
   FailMsg fmsg;
   RcvMsg *rmsg;
 
-  lmsg.file = "abc123.c";
+  lmsg.file = (char *) "abc123.c";
   lmsg.line = 10;
-  fmsg.msg = "oops";
+  fmsg.msg = (char *) "oops";
   pipe(filedes);
   ppack(filedes[1],CK_MSG_LOC, &lmsg);
   ppack(filedes[1],CK_MSG_FAIL, &fmsg);
@@ -290,7 +291,7 @@ START_TEST(test_ppack_multictx)
 
   cmsg.ctx = CK_CTX_SETUP;
   lmsg.line = 5;
-  lmsg.file = "abc123.c";
+  lmsg.file = (char *) "abc123.c";
   pipe(filedes);
   ppack(filedes[1],CK_MSG_CTX, &cmsg);
   ppack(filedes[1],CK_MSG_LOC, &lmsg);
@@ -319,7 +320,7 @@ START_TEST(test_ppack_nofail)
   LocMsg lmsg;
   RcvMsg *rmsg;
 
-  lmsg.file = "abc123.c";
+  lmsg.file = (char *) "abc123.c";
   lmsg.line = 10;
   cmsg.ctx = CK_CTX_SETUP;
   pipe(filedes);
index 61978b3f720c84d0468e625d29045160301b6cf6..c507d808889f033a6a94b590cf88585aa22847be 100644 (file)
@@ -35,7 +35,7 @@ END_TEST
 START_TEST(test_add_end)
 {
   List * lp = list_create();
-  char * tval = "abc";
+  const char * tval = "abc";
   
   list_add_end (lp, tval);
   
@@ -64,8 +64,8 @@ END_TEST
 START_TEST(test_add_end_and_next)
 {
   List *lp = list_create();
-  char *tval1 = "abc";
-  char *tval2 = "123";
+  const char *tval1 = "abc";
+  const char *tval2 = "123";
   
   list_add_end (lp, tval1);
   list_add_end (lp, tval2);