/bin/ksh can't handle a for-loop with no arguments, so add a "." for when

2008-02-09  Matthias Clasen <mclasen@redhat.com>

        * Makefile.decl: /bin/ksh can't handle a for-loop with no
        arguments, so add a "." for when $(SUBDIRS) is empty.

        * glib/tests/option-context.c:
        * glib/tests/testing.c:
        * gthread/gthread-posix.c:
        * tets/testingbase64.c:
        * glib/gtester.c:
        * glib/gsequence.c: Portability fixes.  (#515154)



svn path=/trunk/; revision=6487
This commit is contained in:
Matthias Clasen
2008-02-10 04:41:25 +00:00
committed by Matthias Clasen
parent 634d64c9a1
commit da0e7e81c1
13 changed files with 65 additions and 38 deletions

View File

@@ -1,3 +1,15 @@
2008-02-09 Matthias Clasen <mclasen@redhat.com>
* Makefile.decl: /bin/ksh can't handle a for-loop with no
arguments, so add a "." for when $(SUBDIRS) is empty.
* glib/tests/option-context.c:
* glib/tests/testing.c:
* gthread/gthread-posix.c:
* tets/testingbase64.c:
* glib/gtester.c:
* glib/gsequence.c: Portability fixes. (#515154)
2008-02-07 Tor Lillqvist <tml@novell.com> 2008-02-07 Tor Lillqvist <tml@novell.com>
* configure.in: Unfortunately the mingw implementations of * configure.in: Unfortunately the mingw implementations of

View File

@@ -13,7 +13,7 @@ TEST_PROGS =
# test: run all tests in cwd and subdirs # test: run all tests in cwd and subdirs
test: ${TEST_PROGS} test: ${TEST_PROGS}
@test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
@ for subdir in $(SUBDIRS) ; do \ @ for subdir in $(SUBDIRS) . ; do \
test "$$subdir" = "." -o "$$subdir" = "po" || \ test "$$subdir" = "." -o "$$subdir" = "po" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
done done
@@ -38,7 +38,7 @@ test-report perf-report full-report: ${TEST_PROGS}
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
ignore_logdir=false ; \ ignore_logdir=false ; \
fi ; \ fi ; \
for subdir in $(SUBDIRS) ; do \ for subdir in $(SUBDIRS) . ; do \
test "$$subdir" = "." -o "$$subdir" = "po" || \ test "$$subdir" = "." -o "$$subdir" = "po" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
done ; \ done ; \

View File

@@ -481,7 +481,7 @@ g_buffered_input_stream_fill_async (GBufferedInputStream *stream,
user_data, user_data,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), _("Too large count value passed to %s"),
__FUNCTION__); G_STRFUNC);
return; return;
} }

View File

@@ -183,7 +183,7 @@ g_input_stream_read (GInputStream *stream,
if (((gssize) count) < 0) if (((gssize) count) < 0)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), __FUNCTION__); _("Too large count value passed to %s"), G_STRFUNC);
return -1; return -1;
} }
@@ -315,7 +315,7 @@ g_input_stream_skip (GInputStream *stream,
if (((gssize) count) < 0) if (((gssize) count) < 0)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), __FUNCTION__); _("Too large count value passed to %s"), G_STRFUNC);
return -1; return -1;
} }
@@ -557,7 +557,7 @@ g_input_stream_read_async (GInputStream *stream,
user_data, user_data,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), _("Too large count value passed to %s"),
__FUNCTION__); G_STRFUNC);
return; return;
} }
@@ -682,7 +682,7 @@ g_input_stream_skip_async (GInputStream *stream,
user_data, user_data,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), _("Too large count value passed to %s"),
__FUNCTION__); G_STRFUNC);
return; return;
} }

View File

@@ -190,7 +190,7 @@ g_output_stream_write (GOutputStream *stream,
if (((gssize) count) < 0) if (((gssize) count) < 0)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), __FUNCTION__); _("Too large count value passed to %s"), G_STRFUNC);
return -1; return -1;
} }
@@ -645,7 +645,7 @@ g_output_stream_write_async (GOutputStream *stream,
user_data, user_data,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
_("Too large count value passed to %s"), _("Too large count value passed to %s"),
__FUNCTION__); G_STRFUNC);
return; return;
} }

View File

@@ -128,9 +128,9 @@ test_read_until (void)
int line; int line;
int i; int i;
#define REPEATS 10 // number of rounds #define REPEATS 10 /* number of rounds */
#define DATA_STRING " part1 # part2 $ part3 % part4 ^" #define DATA_STRING " part1 # part2 $ part3 % part4 ^"
#define DATA_PART_LEN 7 // number of characters between separators #define DATA_PART_LEN 7 /* number of characters between separators */
#define DATA_SEP "#$%^" #define DATA_SEP "#$%^"
const int DATA_PARTS_NUM = strlen (DATA_SEP) * REPEATS; const int DATA_PARTS_NUM = strlen (DATA_SEP) * REPEATS;
@@ -262,7 +262,7 @@ test_data_array (GInputStream *stream, GInputStream *base_stream,
break; break;
} }
if ((data) && (! error)) if ((data) && (! error))
g_assert_cmpint (data, ==, TEST_DATA_RETYPE_BUFF(data_type, (buffer + pos))); g_assert_cmpint (data, ==, TEST_DATA_RETYPE_BUFF(data_type, ((guchar*)buffer + pos)));
pos += data_size; pos += data_size;
} }
@@ -289,7 +289,7 @@ test_read_int (void)
guchar x = 0; guchar x = 0;
while (! x) while (! x)
x = (guchar)g_rand_int (rand); x = (guchar)g_rand_int (rand);
*(guchar*)(buffer + sizeof(guchar) * i) = x; *(guchar*)((guchar*)buffer + sizeof(guchar) * i) = x;
} }
base_stream = g_memory_input_stream_new (); base_stream = g_memory_input_stream_new ();

View File

@@ -37,6 +37,7 @@ test_read_lines (GDataStreamNewlineType newline_type)
GError *error = NULL; GError *error = NULL;
gpointer data; gpointer data;
char *lines; char *lines;
int size;
int i; int i;
int size; int size;
@@ -71,7 +72,7 @@ test_read_lines (GDataStreamNewlineType newline_type)
g_assert_cmpint (g_data_output_stream_get_byte_order (G_DATA_OUTPUT_STREAM (stream)), ==, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); g_assert_cmpint (g_data_output_stream_get_byte_order (G_DATA_OUTPUT_STREAM (stream)), ==, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
/* compare data */ /* compare data */
size = strlen(data); size = strlen (data);
g_assert_cmpint (size, <, MAX_LINES_BUFF); g_assert_cmpint (size, <, MAX_LINES_BUFF);
g_assert_cmpstr ((char*)data, ==, lines); g_assert_cmpstr ((char*)data, ==, lines);
@@ -184,25 +185,25 @@ test_data_array (gpointer buffer, int len,
switch (data_type) switch (data_type)
{ {
case TEST_DATA_BYTE: case TEST_DATA_BYTE:
res = g_data_output_stream_put_byte (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_byte (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_INT16: case TEST_DATA_INT16:
res = g_data_output_stream_put_int16 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_int16 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_UINT16: case TEST_DATA_UINT16:
res = g_data_output_stream_put_uint16 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_uint16 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_INT32: case TEST_DATA_INT32:
res = g_data_output_stream_put_int32 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_int32 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_UINT32: case TEST_DATA_UINT32:
res = g_data_output_stream_put_uint32 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_uint32 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_INT64: case TEST_DATA_INT64:
res = g_data_output_stream_put_int64 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_int64 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
case TEST_DATA_UINT64: case TEST_DATA_UINT64:
res = g_data_output_stream_put_uint64 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, (buffer + pos)), NULL, &error); res = g_data_output_stream_put_uint64 (G_DATA_OUTPUT_STREAM (stream), TEST_DATA_RETYPE_BUFF (data_type, ((guchar*)buffer + pos)), NULL, &error);
break; break;
} }
g_assert (error == NULL); g_assert (error == NULL);
@@ -216,7 +217,7 @@ test_data_array (gpointer buffer, int len,
data = 0; data = 0;
while (pos < len) while (pos < len)
{ {
data = TEST_DATA_RETYPE_BUFF(data_type, (stream_data + pos)); data = TEST_DATA_RETYPE_BUFF(data_type, ((guchar*)stream_data + pos));
if (swap) if (swap)
{ {
switch (data_type) switch (data_type)
@@ -237,7 +238,7 @@ test_data_array (gpointer buffer, int len,
break; break;
} }
} }
g_assert_cmpint (data, ==, TEST_DATA_RETYPE_BUFF(data_type, (buffer + pos))); g_assert_cmpint (data, ==, TEST_DATA_RETYPE_BUFF(data_type, ((guchar*)buffer + pos)));
break; break;
pos += data_size; pos += data_size;
@@ -263,7 +264,7 @@ test_read_int (void)
{ {
guchar x = 0; guchar x = 0;
while (! x) x = (guchar)g_rand_int (rand); while (! x) x = (guchar)g_rand_int (rand);
*(guchar*)(buffer + sizeof(guchar) * i) = x; *(guchar*)((guchar*)buffer + sizeof (guchar) * i) = x;
} }
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)

View File

@@ -589,7 +589,11 @@ g_sequence_sort (GSequence *seq,
GCompareDataFunc cmp_func, GCompareDataFunc cmp_func,
gpointer cmp_data) gpointer cmp_data)
{ {
SortInfo info = { cmp_func, cmp_data, seq->end_node }; SortInfo info;
info.cmp_func = cmp_func;
info.cmp_data = cmp_data;
info.end_node = seq->end_node;
check_seq_access (seq); check_seq_access (seq);
@@ -621,11 +625,13 @@ g_sequence_insert_sorted (GSequence *seq,
GCompareDataFunc cmp_func, GCompareDataFunc cmp_func,
gpointer cmp_data) gpointer cmp_data)
{ {
SortInfo info = { cmp_func, cmp_data, NULL }; SortInfo info;
g_return_val_if_fail (seq != NULL, NULL); g_return_val_if_fail (seq != NULL, NULL);
g_return_val_if_fail (cmp_func != NULL, NULL); g_return_val_if_fail (cmp_func != NULL, NULL);
info.cmp_func = cmp_func;
info.cmp_data = cmp_data;
info.end_node = seq->end_node; info.end_node = seq->end_node;
check_seq_access (seq); check_seq_access (seq);
@@ -654,10 +660,12 @@ g_sequence_sort_changed (GSequenceIter *iter,
GCompareDataFunc cmp_func, GCompareDataFunc cmp_func,
gpointer cmp_data) gpointer cmp_data)
{ {
SortInfo info = { cmp_func, cmp_data, NULL }; SortInfo info;
g_return_if_fail (!is_end (iter)); g_return_if_fail (!is_end (iter));
info.cmp_func = cmp_func;
info.cmp_data = cmp_data;
info.end_node = get_sequence (iter)->end_node; info.end_node = get_sequence (iter)->end_node;
check_iter_access (iter); check_iter_access (iter);
@@ -689,10 +697,12 @@ g_sequence_search (GSequence *seq,
GCompareDataFunc cmp_func, GCompareDataFunc cmp_func,
gpointer cmp_data) gpointer cmp_data)
{ {
SortInfo info = { cmp_func, cmp_data, NULL }; SortInfo info;
g_return_val_if_fail (seq != NULL, NULL); g_return_val_if_fail (seq != NULL, NULL);
info.cmp_func = cmp_func;
info.cmp_data = cmp_data;
info.end_node = seq->end_node; info.end_node = seq->end_node;
check_seq_access (seq); check_seq_access (seq);

View File

@@ -273,7 +273,7 @@ launch_test_binary (const char *binary,
GTestLogBuffer *tlb; GTestLogBuffer *tlb;
GSList *slist, *free_list = NULL; GSList *slist, *free_list = NULL;
GError *error = NULL; GError *error = NULL;
const gchar *argv[99 + g_slist_length (subtest_args) + g_slist_length (subtest_paths)]; const gchar *argv[ARG_MAX];
GPid pid = 0; GPid pid = 0;
gint report_pipe[2] = { -1, -1 }; gint report_pipe[2] = { -1, -1 };
guint child_report_cb_id = 0; guint child_report_cb_id = 0;
@@ -293,7 +293,7 @@ launch_test_binary (const char *binary,
argv[i++] = binary; argv[i++] = binary;
for (slist = subtest_args; slist; slist = slist->next) for (slist = subtest_args; slist; slist = slist->next)
argv[i++] = (gchar*) slist->data; argv[i++] = (gchar*) slist->data;
// argv[i++] = "--debug-log"; /* argv[i++] = "--debug-log"; */
if (subtest_quiet) if (subtest_quiet)
argv[i++] = "--quiet"; argv[i++] = "--quiet";
if (subtest_verbose) if (subtest_verbose)

View File

@@ -71,7 +71,11 @@ group_captions (void)
for (j = 0; j < G_N_ELEMENTS (help_variants); ++j) for (j = 0; j < G_N_ELEMENTS (help_variants); ++j)
{ {
gchar *args[] = { __FILE__, help_variants[j], NULL }; gchar *args[3];
args[0] = __FILE__;
args[1] = help_variants[j];
args[2] = NULL;
g_test_message ("test setup: args='%s', main-entries=%d, test-entries=%d", g_test_message ("test setup: args='%s', main-entries=%d, test-entries=%d",
args[1], have_main_entries, have_test_entries); args[1], have_main_entries, have_test_entries);

View File

@@ -57,7 +57,7 @@ test_timer (void)
g_assert_cmpfloat (ttime, >, 0); g_assert_cmpfloat (ttime, >, 0);
g_assert_cmpfloat (g_test_timer_last(), ==, ttime); g_assert_cmpfloat (g_test_timer_last(), ==, ttime);
g_test_minimized_result (ttime, "timer-test-time: %fsec", ttime); g_test_minimized_result (ttime, "timer-test-time: %fsec", ttime);
g_test_maximized_result (5, "bogus-quantity: %ddummies", 5); // simple API test g_test_maximized_result (5, "bogus-quantity: %ddummies", 5); /* simple API test */
} }
/* fork out for a failing test */ /* fork out for a failing test */

View File

@@ -51,7 +51,7 @@
int error = (err); \ int error = (err); \
if (error) \ if (error) \
g_error ("file %s: line %d (%s): error '%s' during '%s'", \ g_error ("file %s: line %d (%s): error '%s' during '%s'", \
__FILE__, __LINE__, __FUNCTION__, \ __FILE__, __LINE__, G_STRFUNC, \
g_strerror (error), name); \ g_strerror (error), name); \
}G_STMT_END }G_STMT_END

View File

@@ -163,7 +163,7 @@ test_base64_encode (void)
length = i + 1; length = i + 1;
text = g_base64_encode (myraw.data, length); text = g_base64_encode (myraw.data, length);
g_assert_cmpstr (text, ==, ok_100_encode_strs[i]); g_assert_cmpstr (text, ==, ok_100_encode_strs[i]);
// printf ("\"%s\",\n",text); /* printf ("\"%s\",\n",text); */
g_free (text); g_free (text);
} }
} }
@@ -179,7 +179,7 @@ decode_and_compare (const gchar *datap,
data2 = g_base64_decode (datap, &len); data2 = g_base64_decode (datap, &len);
g_assert_cmpint (len, ==, p->length); g_assert_cmpint (len, ==, p->length);
// g_print ("length: got %d, expected %d\n",len, length); /* g_print ("length: got %d, expected %d\n",len, length); */
memcmp_decode = memcmp (p->data, data2, p->length); memcmp_decode = memcmp (p->data, data2, p->length);
g_assert_cmpint (memcmp_decode, ==, 0); g_assert_cmpint (memcmp_decode, ==, 0);
g_free (data2); g_free (data2);