2 * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
9 #include "native_client/src/include/nacl_macros.h"
10 #include "native_client/tests/irt_ext/error_report.h"
11 #include "native_client/tests/irt_ext/libc/libc_test.h"
12 #include "native_client/tests/irt_ext/mem_calls.h"
14 typedef int (*TYPE_mem_test)(struct mem_calls_environment *env);
16 static int do_mmap_test(struct mem_calls_environment *env) {
17 mmap(NULL, 0, 0, 0, 0, 0);
18 if (env->num_mmap_calls != 1) {
19 irt_ext_test_print("do_mmap_test: mmap() call was not intercepted.\n");
26 static int do_munmap_test(struct mem_calls_environment *env) {
28 if (env->num_munmap_calls != 1) {
29 irt_ext_test_print("do_munmap_test: munmap() call was not intercepted.\n");
36 static int do_mprotect_test(struct mem_calls_environment *env) {
38 if (env->num_mprotect_calls != 1) {
39 irt_ext_test_print("do_mprotect_test: mprotect() call was not"
47 static const TYPE_mem_test g_mem_tests[] = {
53 static void setup(struct mem_calls_environment *env) {
54 init_mem_calls_environment(env);
55 activate_mem_calls_env(env);
58 static void teardown(void) {
59 deactivate_mem_calls_env();
62 DEFINE_TEST(Mem, g_mem_tests, struct mem_calls_environment, setup, teardown)