Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save braydonf/41091d8a63d111aa2d954dccb1ad0d56 to your computer and use it in GitHub Desktop.
Save braydonf/41091d8a63d111aa2d954dccb1ad0d56 to your computer and use it in GitHub Desktop.
---
configure.ac | 2 +-
tests/run_wine.bash | 5 +++++
tests/strerror_override.c | 3 +++
tests/test1.c | 2 +-
tests/test_util_file.c | 10 ++++------
5 files changed, 14 insertions(+), 8 deletions(-)
create mode 100755 tests/run_wine.bash
diff --git a/configure.ac b/configure.ac
index 9f495af..6f820fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AS_IF([test "x$enable_Bsymbolic" = "xcheck"],
AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
-AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wcast-qual -Wno-error=deprecated-declarations])
+AX_APPEND_COMPILE_FLAGS([-Wall -Wcast-qual -Wno-error=deprecated-declarations])
AX_APPEND_COMPILE_FLAGS([-Wextra -Wwrite-string -Wno-unused-parameter])
AX_APPEND_COMPILE_FLAGS([-D_GNU_SOURCE -D_REENTRANT])
diff --git a/tests/run_wine.bash b/tests/run_wine.bash
new file mode 100755
index 0000000..a063fcb
--- /dev/null
+++ b/tests/run_wine.bash
@@ -0,0 +1,5 @@
+set -e
+for i in *.exe
+do
+ wine $i
+done
diff --git a/tests/strerror_override.c b/tests/strerror_override.c
index d197e7f..0be4971 100644
--- a/tests/strerror_override.c
+++ b/tests/strerror_override.c
@@ -4,6 +4,9 @@
* Override strerror() to get consistent output across platforms.
*/
+#define ETXTBSY 139
+#define ENOTBLK 15
+
static struct {
int errno_value;
const char *errno_str;
diff --git a/tests/test1.c b/tests/test1.c
index b093df7..68706cb 100644
--- a/tests/test1.c
+++ b/tests/test1.c
@@ -35,7 +35,7 @@ static const char *to_json_string(json_object *obj, int flags)
const char *result;
result = json_object_to_json_string_length(obj, flags, &length);
- copy = strndup(result, length);
+ copy = strdup(result);
if (copy == NULL)
printf("to_json_string: Allocation failed!\n");
else {
diff --git a/tests/test_util_file.c b/tests/test_util_file.c
index 950233b..8140608 100644
--- a/tests/test_util_file.c
+++ b/tests/test_util_file.c
@@ -147,8 +147,8 @@ static void test_read_nonexistant()
json_object *jso = json_object_from_file(filename);
if (jso != NULL)
{
- printf("FAIL: json_object_from_file(%s) returned 0x%lx when NULL expected\n",
- filename, (unsigned long)jso);
+ printf("FAIL: json_object_from_file(%s) returned %p when NULL expected\n",
+ filename, jso);
json_object_put(jso);
}
else
@@ -178,14 +178,12 @@ static void test_read_closed()
json_object *jso = json_object_from_fd(fixed_d);
if (jso != NULL)
{
- printf("FAIL: read from closed fd returning non-NULL: 0x%lx\n",
- (unsigned long) jso);
+ printf("FAIL: read from closed fd returning non-NULL: %p\n", jso);
fflush(stdout);
printf(" jso=%s\n", json_object_to_json_string(jso));
json_object_put(jso);
return;
}
printf("OK: json_object_from_fd(closed_fd), "
- "expecting NULL, EBADF, got:0x%lx, %s\n",
- (unsigned long)jso, json_util_get_last_err());
+ "expecting NULL, EBADF, got:%p, %s\n", jso, json_util_get_last_err());
}
--
2.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment