summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/cpio/test/test.h
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/libarchive/files/cpio/test/test.h')
-rw-r--r--archivers/libarchive/files/cpio/test/test.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/archivers/libarchive/files/cpio/test/test.h b/archivers/libarchive/files/cpio/test/test.h
index 77205550465..fcd3304d4ef 100644
--- a/archivers/libarchive/files/cpio/test/test.h
+++ b/archivers/libarchive/files/cpio/test/test.h
@@ -94,30 +94,35 @@
* See below for comments about variable arguments here...
*/
#define assertEqualFile \
- test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_assert_equal_file
+ test_setup(__FILE__, __LINE__);test_assert_equal_file
/* Assert that a file is empty; supports printf-style arguments. */
#define assertEmptyFile \
- test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_assert_empty_file
+ test_setup(__FILE__, __LINE__);test_assert_empty_file
+/* Assert that file contents match a string; supports printf-style arguments. */
+#define assertFileContents \
+ test_setup(__FILE__, __LINE__);test_assert_file_contents
/*
* This would be simple with C99 variadic macros, but I don't want to
- * require that. Instead, I just assign the file/line values here and
- * then replace the function call without trying to pass the variable
- * arguments through the macro. Crude, but effective.
+ * require that. Instead, I insert a function call before each
+ * skipping() call to pass the file and line information down. Crude,
+ * but effective.
*/
#define skipping \
- test_extra=NULL;test_filename=__FILE__;test_line=__LINE__;test_skipping
+ test_setup(__FILE__, __LINE__);test_skipping
/* Function declarations. These are defined in test_utility.c. */
void failure(const char *fmt, ...);
+void test_setup(const char *, int);
void test_skipping(const char *fmt, ...);
-void test_assert(const char *, int, int, const char *, void *);
-void test_assert_empty_file(const char *, ...);
-void test_assert_equal_file(const char *, const char *, ...);
-void test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
-void test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
-void test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
-void test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *);
+int test_assert(const char *, int, int, const char *, void *);
+int test_assert_empty_file(const char *, ...);
+int test_assert_equal_file(const char *, const char *, ...);
+int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
+int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+int test_assert_equal_mem(const char *, int, const char *, const char *, const char *, const char *, size_t, const char *, void *);
+int test_assert_file_contents(const void *, int, const char *, ...);
/* Like sprintf, then system() */
int systemf(const char * fmt, ...);
@@ -132,10 +137,6 @@ char *slurpfile(size_t *, const char *fmt, ...);
/* Directory holding reference files. */
char *refdir;
-/* Filename, line number, pointer to extra data for failure reports. */
-const char *test_filename;
-int test_line;
-void *test_extra;
/*
* Special interfaces for bsdcpio test harness.