summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxmmap01/test_helper.h
diff options
context:
space:
mode:
authorKevin Kirspel <kevin-kirspel@idexx.com>2017-06-29 10:36:44 -0400
committerGedare Bloom <gedare@rtems.org>2017-07-14 16:04:05 -0400
commit1549beb15b8b3d96179ca7d1f95ae845b0462e82 (patch)
treee0cf6b3b87118d62178572b2ad4f62fd60e03dd0 /testsuites/psxtests/psxmmap01/test_helper.h
parentposix/mmap: Add support for file handler and MAP_ANON (diff)
downloadrtems-1549beb15b8b3d96179ca7d1f95ae845b0462e82.tar.bz2
psxtests: Add a mmap dedicated test case
Updates #2859
Diffstat (limited to '')
-rw-r--r--testsuites/psxtests/psxmmap01/test_helper.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxmmap01/test_helper.h b/testsuites/psxtests/psxmmap01/test_helper.h
new file mode 100644
index 0000000000..65ca3c11bd
--- /dev/null
+++ b/testsuites/psxtests/psxmmap01/test_helper.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017 Kevin Kirspel.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <string.h>
+
+#define mmap_test_assert(__exp, fmt, ...) \
+ do { \
+ if (!(__exp)) { \
+ fail_check(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+ rtems_test_exit(0); \
+ } \
+ } while (0)
+
+#define mmap_test_check(__exp, fmt, ...) \
+ do { \
+ if (!(__exp)) { \
+ fail_check(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
+ } else { \
+ rtems_test_assert(__exp); \
+ }\
+ } while (0)
+
+#define mmap_test_assert_equal(expected, actual, fmt, ...) \
+ mmap_test_assert((expected) == (actual), "%s != %s: " fmt, \
+ #expected, #actual, ##__VA_ARGS__)
+
+#define mmap_test_check_equal(expected, actual, fmt, ...) \
+ mmap_test_check((expected) == (actual), "%s != %s: " fmt, \
+ #expected, #actual, ##__VA_ARGS__)
+
+extern void fail_check(
+ const char *file,
+ const size_t line,
+ const char *fmt,
+ ...
+);