#include "test_common.h"
+extern char *lustre_path;
+
#define ENTRY(str) \
do { \
char buf[100]; \
void t1()
{
- char *path="/mnt/lustre/test_t1";
+ char path[MAX_PATH_LENGTH] = "";
+
ENTRY("create/delete");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t1", lustre_path);
t_touch(path);
t_unlink(path);
void t2()
{
- char *path="/mnt/lustre/test_t2";
+ char path[MAX_PATH_LENGTH] = "";
+
ENTRY("mkdir/rmdir");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t2", lustre_path);
t_mkdir(path);
t_rmdir(path);
void t3()
{
- char *path="/mnt/lustre/test_t3";
+ char path[MAX_PATH_LENGTH] = "";
+
ENTRY("regular stat");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t3", lustre_path);
t_touch(path);
t_check_stat(path, NULL);
void t4()
{
- char *path="/mnt/lustre/test_t4";
+ char path[MAX_PATH_LENGTH] = "";
+
ENTRY("dir stat");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t4", lustre_path);
t_mkdir(path);
t_check_stat(path, NULL);
void t6()
{
- char *path="/mnt/lustre/test_t6";
- char *path2="/mnt/lustre/test_t6_link";
+ char path[MAX_PATH_LENGTH] = "";
+ char path2[MAX_PATH_LENGTH] = "";
+
ENTRY("symlink");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t6", lustre_path);
+ snprintf(path2, MAX_PATH_LENGTH, "%s/test_t6_link", lustre_path);
t_touch(path);
t_symlink(path, path2);
void t7()
{
- char *path="/mnt/lustre/test_t7";
+ char path[MAX_PATH_LENGTH] = "";
int rc;
+
ENTRY("mknod");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t7", lustre_path);
if (geteuid() != 0) {
rc = mknod(path, S_IFCHR | 0644, (5<<8 | 4));
void t8()
{
- char *path="/mnt/lustre/test_t8";
+ char path[MAX_PATH_LENGTH] = "";
+
ENTRY("chmod");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t8", lustre_path);
t_touch(path);
t_chmod_raw(path, 0700);
void t9()
{
- char *path="/mnt/lustre/test_t9";
- char *path2="/mnt/lustre/test_t9_link";
+ char path[MAX_PATH_LENGTH] = "";
+ char path2[MAX_PATH_LENGTH] = "";
+
ENTRY("hard link");
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t9", lustre_path);
+ snprintf(path2, MAX_PATH_LENGTH, "%s/test_t9_link", lustre_path);
t_touch(path);
t_link(path, path2);
void t10()
{
- char *dir1="/mnt/lustre/test_t10_dir1";
- char *dir2="/mnt/lustre/test_t10_dir2";
- char *path1="/mnt/lustre/test_t10_reg1";
- char *path2="/mnt/lustre/test_t10_reg2";
- char *rename1="/mnt/lustre/test_t10_dir1/rename1";
- char *rename2="/mnt/lustre/test_t10_dir2/rename2";
- char *rename3="/mnt/lustre/test_t10_dir2/rename3";
+ char dir1[MAX_PATH_LENGTH] = "";
+ char dir2[MAX_PATH_LENGTH] = "";
+ char path1[MAX_PATH_LENGTH] = "";
+ char path2[MAX_PATH_LENGTH] = "";
+ char rename1[MAX_PATH_LENGTH] = "";
+ char rename2[MAX_PATH_LENGTH] = "";
+ char rename3[MAX_PATH_LENGTH] = "";
+
ENTRY("rename");
+ snprintf(dir1, MAX_PATH_LENGTH, "%s/test_t10_dir1", lustre_path);
+ snprintf(dir2, MAX_PATH_LENGTH, "%s/test_t10_dir2", lustre_path);
+ snprintf(path1, MAX_PATH_LENGTH, "%s/test_t10_reg1", lustre_path);
+ snprintf(path2, MAX_PATH_LENGTH, "%s/test_t10_reg2", lustre_path);
+ snprintf(rename1, MAX_PATH_LENGTH, "%s/test_t10_dir1/rename1", lustre_path);
+ snprintf(rename2, MAX_PATH_LENGTH, "%s/test_t10_dir1/rename2", lustre_path);
+ snprintf(rename3, MAX_PATH_LENGTH, "%s/test_t10_dir1/rename3", lustre_path);
t_mkdir(dir1);
t_mkdir(dir2);
void t11()
{
- char *base="/mnt/lustre";
+ char *base=lustre_path;
char path[MAX_PATH_LENGTH], path2[MAX_PATH_LENGTH];
int i, j, level = 5, nreg = 5;
ENTRY("deep tree");
void t12()
{
- char *dir="/mnt/lustre/test_t12_dir";
+ char dir[MAX_PATH_LENGTH] = "";
char buf[1024*128];
int fd;
ENTRY("empty directory readdir");
+ snprintf(dir, MAX_PATH_LENGTH, "%s/test_t12_dir", lustre_path);
t_mkdir(dir);
fd = t_opendir(dir);
void t13()
{
- char *dir="/mnt/lustre/test_t13_dir/";
+ char dir[MAX_PATH_LENGTH] = "";
char name[1024];
char buf[1024];
const int nfiles = 20;
char *prefix = "test13_filename_prefix_";
int fd, i;
ENTRY("multiple entries directory readdir");
+ snprintf(dir, MAX_PATH_LENGTH, "%s/test_t13_dir/", lustre_path);
t_mkdir(dir);
printf("Creating %d files...\n", nfiles);
void t14()
{
- char *dir="/mnt/lustre/test_t14_dir/";
+ char dir[MAX_PATH_LENGTH] = "";
char name[1024];
char buf[1024];
const int nfiles = 256;
int fd, i, rc, pos, index;
loff_t base = 0;
ENTRY(">1 block(4k) directory readdir");
+ snprintf(dir, MAX_PATH_LENGTH, "%s/test_t14_dir/", lustre_path);
t_mkdir(dir);
printf("Creating %d files...\n", nfiles);
void t15()
{
- char *file = "/mnt/lustre/test_t15_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
ENTRY("open-stat-close");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t15_file", lustre_path);
t_touch(file);
fd = t_open(file);
void t16()
{
- char *file = "/mnt/lustre/test_t16_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
ENTRY("small-write-read");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t16_file", lustre_path);
t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaa");
t_grep(file, "aaaaaaaaaaaaaaaaaaaaaa");
void t17()
{
- char *file = "/mnt/lustre/test_t17_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
ENTRY("open-unlink without close");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t17_file", lustre_path);
fd = open(file, O_WRONLY | O_CREAT, 0666);
if (fd < 0) {
void t18()
{
- char *file = "/mnt/lustre/test_t18_file";
+ char file[MAX_PATH_LENGTH] = "";
char buf[128];
int fd, i;
struct stat statbuf[3];
ENTRY("write should change mtime/atime");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t18_file", lustre_path);
for (i = 0; i < 3; i++) {
fd = open(file, O_RDWR|O_CREAT|O_APPEND, (mode_t)0666);
void t19()
{
- char *file = "/mnt/lustre/test_t19_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
struct stat statbuf;
ENTRY("open(O_TRUNC) should trancate file to 0-length");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t19_file", lustre_path);
t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
void t20()
{
- char *file = "/mnt/lustre/test_t20_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
struct iovec iov[2];
char buf[100];
ssize_t ret;
ENTRY("trap app's general bad pointer for file i/o");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t20_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
if (fd < 0) {
void t21()
{
- char *file = "/mnt/lustre/test_t21_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd, ret;
ENTRY("basic fcntl support");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t21_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
if (fd < 0) {
void t22()
{
- char *file = "/mnt/lustre/test_t22_file";
+ char file[MAX_PATH_LENGTH] = "";
int fd;
char *str = "1234567890";
char buf[100];
ssize_t ret;
ENTRY("make sure O_APPEND take effect");
+ snprintf(file, MAX_PATH_LENGTH, "%s/test_t22_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT|O_APPEND, (mode_t)0666);
if (fd < 0) {
*/
static void pages_io(int xfer, loff_t pos)
{
- char *path="/mnt/lustre/test_t50";
+ char path[MAX_PATH_LENGTH] = "";
+
int check_sum[_npages] = {0,};
int fd, rc, i, j, data_error = 0;
struct timeval tw1, tw2, tr1, tr2;
double tw, tr;
+ snprintf(path, MAX_PATH_LENGTH, "%s/test_t50", lustre_path);
memset(_buffer, 0, sizeof(_buffer));
/* create sample data */