]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/perf_index/perfindex-ram_file_read.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tools / tests / perf_index / perfindex-ram_file_read.c
CommitLineData
fe8ab488
A
1#include "perf_index.h"
2#include "fail.h"
3#include "test_file_helper.h"
4#include "ramdisk.h"
5#include <sys/param.h>
6#include <stdio.h>
7
8const char ramdisk_name[] = "StressRAMDisk";
9char ramdisk_path[MAXPATHLEN];
10
11DECL_SETUP {
0a7de745 12 int retval;
fe8ab488 13
0a7de745
A
14 retval = setup_ram_volume(ramdisk_name, ramdisk_path);
15 VERIFY(retval == PERFINDEX_SUCCESS, "setup_ram_volume failed");
fe8ab488 16
0a7de745 17 printf("ramdisk: %s\n", ramdisk_path);
fe8ab488 18
0a7de745 19 return test_file_read_setup(ramdisk_path, num_threads, length, 0L);
fe8ab488
A
20}
21
22DECL_TEST {
0a7de745 23 return test_file_read(ramdisk_path, thread_id, num_threads, length, 0L);
fe8ab488
A
24}
25
26DECL_CLEANUP {
0a7de745 27 int retval;
fe8ab488 28
0a7de745
A
29 retval = test_file_read_cleanup(ramdisk_path, num_threads, length);
30 VERIFY(retval == PERFINDEX_SUCCESS, "test_file_read_cleanup failed");
fe8ab488 31
0a7de745
A
32 retval = cleanup_ram_volume(ramdisk_path);
33 VERIFY(retval == 0, "cleanup_ram_volume failed");
fe8ab488 34
0a7de745 35 return PERFINDEX_SUCCESS;
fe8ab488 36}