-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 2 tests about mount/umount #75
base: sgx-lkl
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,24 +19,21 @@ | |
#include <sys/types.h> | ||
#include "tst_test.h" | ||
|
||
#define MNTPOINT "mnt_point" | ||
#define FNAME MNTPOINT"/test" | ||
#define FNAME "/data/test" | ||
#define FILE_SIZE_MB 32 | ||
#define FILE_SIZE (FILE_SIZE_MB * TST_MB) | ||
#define MODE 0644 | ||
#define dev "/dev/vda" | ||
#define dev "/dev/vdb" | ||
|
||
static void verify_fdatasync(void) | ||
{ | ||
int fd; | ||
unsigned long written; | ||
|
||
rmdir(MNTPOINT); | ||
SAFE_MKDIR(MNTPOINT, 0644); | ||
SAFE_MOUNT(dev, MNTPOINT, "ext4", 0, NULL); | ||
fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE); | ||
|
||
tst_dev_bytes_written(dev); | ||
fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE); | ||
|
||
tst_dev_bytes_written(dev); | ||
|
||
tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB); | ||
|
||
|
@@ -45,12 +42,10 @@ static void verify_fdatasync(void) | |
if (TST_RET) | ||
tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed"); | ||
|
||
written = tst_dev_bytes_written(dev); | ||
written = tst_dev_bytes_written(dev); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually indentation was wrong before, now it is correct :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shaikshavali1 I assume LTP_DEV will have the /dev/vdb in it. But how about tst_dev_bytes_written, what should we pass to it? |
||
|
||
SAFE_CLOSE(fd); | ||
remove(FNAME); | ||
SAFE_UMOUNT(MNTPOINT); | ||
SAFE_RMDIR(MNTPOINT); | ||
remove(FNAME); | ||
|
||
if (written >= FILE_SIZE) | ||
tst_res(TPASS, "Test file data synced to device"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,14 @@ | |
#include "lapi/sync_file_range.h" | ||
#include "check_sync_file_range.h" | ||
|
||
#define MNTPOINT "mnt_point" | ||
#define MNTPOINT "/data" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not required. Please add below config parameters to tst_test test structure initialization in fdatasync03.c file. By enabling above options, test framework will mount the file system at the time of test initialization time. |
||
#define FNAME1 MNTPOINT"/test1" | ||
#define FNAME2 MNTPOINT"/test2" | ||
#define FNAME3 MNTPOINT"/test3" | ||
#define FILE_SZ_MB 32 | ||
#define FILE_SZ (FILE_SZ_MB * TST_MB) | ||
#define MODE 0644 | ||
#define dev "/dev/vdb" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not required. |
||
|
||
struct testcase { | ||
char *fname; | ||
|
@@ -48,7 +49,7 @@ static void verify_sync_file_range(struct testcase *tc) | |
|
||
lseek(fd, tc->write_off, SEEK_SET); | ||
|
||
tst_dev_bytes_written(tst_device->dev); | ||
tst_dev_bytes_written(dev); | ||
|
||
tst_fill_fd(fd, 0, TST_MB, tc->write_size_mb); | ||
|
||
|
@@ -60,7 +61,7 @@ static void verify_sync_file_range(struct testcase *tc) | |
if (TST_RET) | ||
tst_brk(TFAIL | TTERRNO, "sync_file_range() failed"); | ||
|
||
written = tst_dev_bytes_written(tst_device->dev); | ||
written = tst_dev_bytes_written(dev); | ||
|
||
fsync(fd); | ||
|
||
|
@@ -124,10 +125,6 @@ static void setup(void) | |
static struct tst_test test = { | ||
.tcnt = ARRAY_SIZE(testcases), | ||
.needs_root = 1, | ||
.mount_device = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add below config parameters to tst_test test structure initialization in fdatasync03.c file. By enabling above options, test framework will mount the file system at the time of test initialization time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shaikshavali1 we have already /data and /dev/vdb mounted. Why are we mounting again? Do we really need to mount again? |
||
.all_filesystems = 1, | ||
.dev_fs_flags = TST_FS_SKIP_FUSE, | ||
.mntpoint = MNTPOINT, | ||
.setup = setup, | ||
.test = run, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required now. Please add below config parameters to tst_test test structure initialization in fdatasync03.c file.
.mount_device = 1,
.all_filesystems = 1,
.mntpoint = MNTPOINT,
By enabling above options, test framework will mount the file system at the time of test initialization time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shaikshavali1 can you give more explanation. We are creating test image and mapping to /dev/vdb and /data in config. Why do we need to mount again? Why don't I need to specify /dev/vdb? Why do we need to mount again?