|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 8d95631ea6c039a60bb7ac456f687a8fdf0c4381 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Filipe Brandenburger <filbranden@google.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Mon, 25 Aug 2014 22:05:03 -0700
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] test-path-util: use assert_se in all assertions
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Otherwise they get optimized out when CPPFLAGS='-DNDEBUG' is used, and that
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
causes the tests to fail.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Tested:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- make check TESTS='test-path-util' CPPFLAGS='-DNDEBUG'
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/test/test-path-util.c | 30 +++++++++++++++---------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 15 insertions(+), 15 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index c8dcd85397..01afb3e6fe 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/test/test-path-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/test/test-path-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -79,35 +79,35 @@ static void test_path(void) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char p2[] = "//aaa/.////ccc";
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char p3[] = "/./";
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(path_equal(path_kill_slashes(p1), "aaa/bbb/ccc"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(path_equal(path_kill_slashes(p2), "/aaa/./ccc"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(path_equal(path_kill_slashes(p3), "/./"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(path_equal(path_kill_slashes(p1), "aaa/bbb/ccc"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(path_equal(path_kill_slashes(p2), "/aaa/./ccc"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(path_equal(path_kill_slashes(p3), "/./"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void test_find_binary(const char *self) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char *p;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(find_binary("/bin/sh", &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(find_binary("/bin/sh", &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
puts(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(streq(p, "/bin/sh"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(streq(p, "/bin/sh"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
free(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(find_binary(self, &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(find_binary(self, &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
puts(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(endswith(p, "/test-path-util"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(path_is_absolute(p));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(endswith(p, "/test-path-util"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(path_is_absolute(p));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
free(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(find_binary("sh", &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(find_binary("sh", &p) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
puts(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(endswith(p, "/sh"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(path_is_absolute(p));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(endswith(p, "/sh"));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(path_is_absolute(p));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
free(p);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(find_binary("xxxx-xxxx", &p) == -ENOENT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(find_binary("xxxx-xxxx", &p) == -ENOENT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(find_binary("/some/dir/xxxx-xxxx", &p) == -ENOENT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(find_binary("/some/dir/xxxx-xxxx", &p) == -ENOENT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void test_prefixes(void) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -156,8 +156,8 @@ static void test_prefixes(void) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
b = false;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
PATH_FOREACH_PREFIX_MORE(s, "") {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(!b);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- assert(streq(s, ""));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(!b);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(streq(s, ""));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
b = true;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|