aboutgitcodelistschat:MatrixIRC
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/Makefile5
-rw-r--r--tests/unit/test_filter.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/unit/Makefile b/tests/unit/Makefile
index fac3f68..ae9631b 100644
--- a/tests/unit/Makefile
+++ b/tests/unit/Makefile
@@ -38,7 +38,7 @@ CFLAGS += -DSEITAN_AUDIT_ARCH=AUDIT_ARCH_$(AUDIT_ARCH) -DTMP_DATA_SIZE=1000
test: test-filter test-operations test-op-call
-build-filter-build: test_filter_build.c $(SRCS_FILTER_BUILD) $(HEADERS_FILTER_BUILD)
+build-filter-build: test_filter_build.c $ (SRCS_FILTER_BUILD) $(HEADERS_FILTER_BUILD)
$(CC) $(CFLAGS) -o filter-build $(SRCS_FILTER) \
test_filter_build.c
@@ -65,3 +65,6 @@ build-operations: test_operations.c $(SRCS_OP) $(HEADERS_OP)
test-operations: build-operations
./operations
+
+clean:
+ rm -f operations op-call filter filter-build
diff --git a/tests/unit/test_filter.c b/tests/unit/test_filter.c
index 90ffa2b..5745ba2 100644
--- a/tests/unit/test_filter.c
+++ b/tests/unit/test_filter.c
@@ -35,6 +35,7 @@ static int generate_install_filter(struct args_target *at)
calls[0].args[i].cmp = NO_CHECK;
continue;
}
+ calls[0].args[i].cmp = at->cmp[i];
switch (at->type[i]) {
case U32:
calls[0].args[i].value.v32 = (uint32_t)at->args[i];
@@ -73,6 +74,7 @@ START_TEST(with_getsid)
set_args_no_check(at);
at->args[0] = &id;
at->type[0] = U32;
+ at->cmp[0] = EQ;
at->install_filter = generate_install_filter;
setup();
mock_syscall_target();
@@ -90,8 +92,10 @@ START_TEST(with_getpriority)
set_args_no_check(at);
at->args[0] = &which;
at->type[0] = U32;
+ at->cmp[0] = EQ;
at->args[1] = &who;
- at->type[0] = U32;
+ at->type[1] = U32;
+ at->cmp[1] = EQ;
at->install_filter = generate_install_filter;
setup();
mock_syscall_target();
@@ -104,7 +108,7 @@ static int target_lseek()
/* Open the device on the target, but the arg0 isn't in the filter */
ck_assert_int_ge(fd, 0);
- at->args[0] = fd;
+ at->args[0] = (void *)(long)fd;
return target();
}
@@ -116,7 +120,7 @@ static void test_lseek(off_t offset)
at->nr = __NR_lseek;
at->target = target_lseek;
set_args_no_check(at);
- at->args[1] = offset;
+ at->args[1] = (void *)offset;
at->type[1] = U64;
at->install_filter = generate_install_filter;
setup();