aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeegan McAllister <keegan@ksplice.com>2010-12-16 11:53:00 -0500
committerJon Masters <jcm@jonmasters.org>2011-04-13 03:01:11 -0400
commitc8d228807fbf960334f6f3306f0a1414ad7f2b0d (patch)
treed7488a0324f62efb57492e50d4e64a8bf5159614
parent6253bd13a529813af724ca9800f9253407236e44 (diff)
downloadmodule-init-tools-c8d228807fbf960334f6f3306f0a1414ad7f2b0d.tar.gz
testsuite: mock unlink()
Needed by depmod. Signed-off-by: Keegan McAllister <keegan@ksplice.com>
-rw-r--r--testing.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/testing.h b/testing.h
index 1fe234a..9d6090a 100644
--- a/testing.h
+++ b/testing.h
@@ -41,6 +41,8 @@ __attribute__((unused));
static int modtest_readlink(const char *path, char *buf, size_t bufsiz)
__attribute__((unused));
+static int modtest_unlink(const char *path)
+__attribute__((unused));
static int modtest_uname(struct utsname *buf)
{
@@ -215,6 +217,14 @@ static int modtest_readlink(const char *path, char *buf, size_t bufsiz)
return readlink(path, buf, bufsiz);
}
+static int modtest_unlink(const char *path)
+{
+ char path_buf[PATH_MAX];
+
+ path = modtest_mapname(path, path_buf, sizeof(path_buf));
+ return unlink(path);
+}
+
#ifdef CONFIG_USE_ZLIB
#include <zlib.h>
static gzFile *modtest_gzopen(const char *path, const char *mode)
@@ -244,6 +254,7 @@ static gzFile *modtest_gzopen(const char *path, const char *mode)
#define system modtest_system
#define rename modtest_rename
#define readlink modtest_readlink
+#define unlink modtest_unlink
#define gzopen modtest_gzopen
#endif /* JUST_TESTING */