summaryrefslogtreecommitdiff
path: root/tests/tap/basic.h
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2018-05-27 20:59:59 -0700
committerRuss Allbery <eagle@eyrie.org>2018-05-27 20:59:59 -0700
commitbdcb3741db27d6b773ce7cdf05aab063a70ea100 (patch)
tree11e11bb646e0b58db6e23b59e3c856ea59ef3545 /tests/tap/basic.h
parent62a9101895a2d596bf91231f119d338d2025ff08 (diff)
Update to rra-c-util 7.2 and C TAP Harness 4.3
Update to rra-c-util 7.2: * Improve configure output for krb5-config testing. * Define UINT32_MAX for systems that don't have it. * Add SPDX-License-Identifier headers to all substantial source files. * Fix new warnings from GCC 7 and Clang warnings. * Require Test::Strict 0.25 or later to run those tests. * Fix off-by-one error in return-value checks for snprintf. * Use Autoconf to probe for supported warning flags. * Fix running module-version-t -u with current versions of Perl. * Use C_TAP_SOURCE and C_TAP_BUILD instead of SOURCE and BUILD. Update to C TAP Harness 4.3: * Add support for valgrind and libtool in test lists. * Report test failures as left and right, not wanted and expected. * Fix string comparisons with NULL pointers and the string "(null)". * Add SPDX-License-Identifier headers to all substantial source files. * Avoid zero-length realloc allocations in breallocarray. * Fix new warnings from GCC 7 and Clang warnings. * Use C_TAP_SOURCE and C_TAP_BUILD instead of SOURCE and BUILD.
Diffstat (limited to 'tests/tap/basic.h')
-rw-r--r--tests/tap/basic.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/tests/tap/basic.h b/tests/tap/basic.h
index 4ecaaec..3f46e4f 100644
--- a/tests/tap/basic.h
+++ b/tests/tap/basic.h
@@ -2,11 +2,11 @@
* Basic utility routines for the TAP protocol.
*
* This file is part of C TAP Harness. The current version plus supporting
- * documentation is at <http://www.eyrie.org/~eagle/software/c-tap-harness/>.
+ * documentation is at <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
*
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015
- * Russ Allbery <eagle@eyrie.org>
- * Copyright 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2014
+ * Written by Russ Allbery <eagle@eyrie.org>
+ * Copyright 2009-2018 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2001-2002, 2004-2008, 2011-2012, 2014
* The Board of Trustees of the Leland Stanford Junior University
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -26,6 +26,8 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
*/
#ifndef TAP_BASIC_H
@@ -88,15 +90,21 @@ void skip_block(unsigned long count, const char *reason, ...)
__attribute__((__format__(printf, 2, 3)));
/*
- * Check an expected value against a seen value. Returns true if the test
- * passes and false if it fails.
+ * Compare two values. Returns true if the test passes and false if it fails.
+ * is_bool takes an int since the bool type isn't fully portable yet, but
+ * interprets both arguments for their truth value, not for their numeric
+ * value.
*/
-int is_int(long wanted, long seen, const char *format, ...)
+int is_bool(int, int, const char *format, ...)
+ __attribute__((__format__(printf, 3, 4)));
+int is_int(long, long, const char *format, ...)
__attribute__((__format__(printf, 3, 4)));
-int is_string(const char *wanted, const char *seen, const char *format, ...)
+int is_string(const char *, const char *, const char *format, ...)
__attribute__((__format__(printf, 3, 4)));
-int is_hex(unsigned long wanted, unsigned long seen, const char *format, ...)
+int is_hex(unsigned long, unsigned long, const char *format, ...)
__attribute__((__format__(printf, 3, 4)));
+int is_blob(const void *, const void *, size_t, const char *format, ...)
+ __attribute__((__format__(printf, 4, 5)));
/* Bail out with an error. sysbail appends strerror(errno). */
void bail(const char *format, ...)
@@ -137,16 +145,16 @@ char *bstrndup(const char *, size_t)
__attribute__((__malloc__, __nonnull__, __warn_unused_result__));
/*
- * Find a test file under BUILD or SOURCE, returning the full path. The
- * returned path should be freed with test_file_path_free().
+ * Find a test file under C_TAP_BUILD or C_TAP_SOURCE, returning the full
+ * path. The returned path should be freed with test_file_path_free().
*/
char *test_file_path(const char *file)
__attribute__((__malloc__, __nonnull__, __warn_unused_result__));
void test_file_path_free(char *path);
/*
- * Create a temporary directory relative to BUILD and return the path. The
- * returned path should be freed with test_tmpdir_free.
+ * Create a temporary directory relative to C_TAP_BUILD and return the path.
+ * The returned path should be freed with test_tmpdir_free().
*/
char *test_tmpdir(void)
__attribute__((__malloc__, __warn_unused_result__));