You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/04/22 22:12:56 UTC
svn commit: r937043 - in /subversion/trunk/subversion/tests:
libsvn_subr/stream-test.c svn_test_main.c
Author: stsp
Date: Thu Apr 22 20:12:55 2010
New Revision: 937043
URL: http://svn.apache.org/viewvc?rev=937043&view=rev
Log:
Revert r936802, and do it the right way.
SVN_ERR_ASSERT() should not be used in tests, SVN_TEST_ASSERT() should
be used instead.
Suggested by: gstein
* subversion/tests/svn_test_main.c
(main): Stop overriding the default malfunction handler.
* subversion/tests/libsvn_subr/stream-test.c
(test_stream_range, test_stream_line_filter,
test_stream_line_transformer, test_stream_line_filter_and_transformer,
test_stream_seek_file, test_stream_seek_stringbuf,
test_stream_seek_translated): Use SVN_TEST_ASSERT() instead of
SVN_ERR_ASSERT().
Modified:
subversion/trunk/subversion/tests/libsvn_subr/stream-test.c
subversion/trunk/subversion/tests/svn_test_main.c
Modified: subversion/trunk/subversion/tests/libsvn_subr/stream-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/stream-test.c?rev=937043&r1=937042&r2=937043&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/stream-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/stream-test.c Thu Apr 22 20:12:55 2010
@@ -296,11 +296,11 @@ test_stream_range(apr_pool_t *pool)
stream = svn_stream_from_aprfile_range_readonly(f, TRUE, 0, -1, pool);
len = 42;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 0);
+ SVN_TEST_ASSERT(len == 0);
stream = svn_stream_from_aprfile_range_readonly(f, TRUE, -1, 0, pool);
len = 42;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 0);
+ SVN_TEST_ASSERT(len == 0);
SVN_ERR(svn_stream_close(stream));
apr_file_close(f);
@@ -333,15 +333,15 @@ test_stream_line_filter(apr_pool_t *pool
svn_stream_set_line_filter_callback(stream, line_filter);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, lines[0]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, lines[0]) == 0);
/* line[1] should be filtered */
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, lines[2]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, lines[2]) == 0);
/* The last line should also be filtered, and the resulting
* stringbuf should be empty. */
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(eof && svn_stringbuf_isempty(line));
+ SVN_TEST_ASSERT(eof && svn_stringbuf_isempty(line));
return SVN_NO_ERROR;
}
@@ -387,20 +387,20 @@ test_stream_line_transformer(apr_pool_t
svn_stream_set_line_transformer_callback(stream, line_transformer);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[0]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[0]) == 0);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[1]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[1]) == 0);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[2]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[2]) == 0);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[3]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[3]) == 0);
/* We should have reached eof and the stringbuf should be emtpy. */
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(eof && svn_stringbuf_isempty(line));
+ SVN_TEST_ASSERT(eof && svn_stringbuf_isempty(line));
return SVN_NO_ERROR;
}
@@ -429,15 +429,15 @@ test_stream_line_filter_and_transformer(
/* Line one should be filtered. */
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[1]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[1]) == 0);
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(strcmp(line->data, inv_lines[2]) == 0);
+ SVN_TEST_ASSERT(strcmp(line->data, inv_lines[2]) == 0);
/* The last line should also be filtered, and the resulting
* stringbuf should be empty. */
svn_stream_readline(stream, &line, "\n", &eof, pool);
- SVN_ERR_ASSERT(eof && svn_stringbuf_isempty(line));
+ SVN_TEST_ASSERT(eof && svn_stringbuf_isempty(line));
return SVN_NO_ERROR;
@@ -505,19 +505,19 @@ test_stream_seek_file(apr_pool_t *pool)
stream = svn_stream_from_aprfile2(f, FALSE, pool);
SVN_ERR(svn_stream_reset(stream));
SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));
- SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[0]) == 0);
+ SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[0]) == 0);
/* Set a mark at the beginning of the second line of the file. */
SVN_ERR(svn_stream_mark(stream, &mark, pool));
/* Read the second line and then seek back to the mark. */
SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));
- SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);
+ SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);
SVN_ERR(svn_stream_seek(stream, mark));
/* The next read should return the second line again. */
SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));
- SVN_ERR_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);
+ SVN_TEST_ASSERT(! eof && strcmp(line->data, file_data[1]) == 0);
/* The next read should return EOF. */
SVN_ERR(svn_stream_readline(stream, &line, NL, &eof, pool));
- SVN_ERR_ASSERT(eof);
+ SVN_TEST_ASSERT(eof);
SVN_ERR(svn_stream_close(stream));
@@ -538,17 +538,17 @@ test_stream_seek_stringbuf(apr_pool_t *p
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "One") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "One") == 0);
SVN_ERR(svn_stream_mark(stream, &mark, pool));
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "Two") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "Two") == 0);
SVN_ERR(svn_stream_seek(stream, mark));
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "Two") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "Two") == 0);
SVN_ERR(svn_stream_close(stream));
@@ -575,59 +575,59 @@ test_stream_seek_translated(apr_pool_t *
FALSE, keywords, TRUE, pool);
len = 3;
SVN_ERR(svn_stream_read(translated_stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "One") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "One") == 0);
/* Seek from outside of keyword to inside of keyword. */
SVN_ERR(svn_stream_mark(translated_stream, &mark, pool));
len = 3;
SVN_ERR(svn_stream_read(translated_stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
/* ### The test currently fails here because the keyword isn't
* ### expanded correctly. buf contains "$My\0" */
- SVN_ERR_ASSERT(strcmp(buf, "my ") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "my ") == 0);
SVN_ERR(svn_stream_seek(stream, mark));
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "my ") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "my ") == 0);
/* Seek from inside of keyword to inside of keyword. */
SVN_ERR(svn_stream_mark(translated_stream, &mark, pool));
len = 3;
SVN_ERR(svn_stream_read(translated_stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "key") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "key") == 0);
SVN_ERR(svn_stream_seek(stream, mark));
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "my ") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "my ") == 0);
/* Seek from inside of keyword to outside of keyword. */
len = 22;
SVN_ERR(svn_stream_read(translated_stream, buf, &len));
- SVN_ERR_ASSERT(len == 22);
+ SVN_TEST_ASSERT(len == 22);
buf[22] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "keyword was expandedTw") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "keyword was expandedTw") == 0);
SVN_ERR(svn_stream_mark(translated_stream, &mark2, pool));
SVN_ERR(svn_stream_seek(stream, mark));
len = 3;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 3);
+ SVN_TEST_ASSERT(len == 3);
buf[3] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "my ") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "my ") == 0);
SVN_ERR(svn_stream_seek(stream, mark2));
len = 1;
SVN_ERR(svn_stream_read(stream, buf, &len));
- SVN_ERR_ASSERT(len == 1);
+ SVN_TEST_ASSERT(len == 1);
buf[1] = '\0';
- SVN_ERR_ASSERT(strcmp(buf, "o") == 0);
+ SVN_TEST_ASSERT(strcmp(buf, "o") == 0);
SVN_ERR(svn_stream_close(stream));
Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=937043&r1=937042&r2=937043&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Thu Apr 22 20:12:55 2010
@@ -383,10 +383,6 @@ main(int argc, const char *argv[])
cleanup_pool = svn_pool_create(pool);
test_pool = svn_pool_create(pool);
- /* Make sure we don't abort() on SVN_ERR_ASSERT() failures,
- * to allow for clean XFAIL tests. */
- svn_error_set_malfunction_handler(svn_error_raise_on_malfunction);
-
if (argc >= 2) /* notice command-line arguments */
{
if (! strcmp(argv[1], "list") || list_mode)