Skip to content
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

Open
wants to merge 1 commit into
base: sgx-lkl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions testcases/kernel/syscalls/fdatasync/fdatasync03.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

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.

Copy link
Collaborator Author

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?


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);

Expand All @@ -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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually indentation was wrong before, now it is correct :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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");
Expand Down
11 changes: 4 additions & 7 deletions testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
#include "lapi/sync_file_range.h"
#include "check_sync_file_range.h"

#define MNTPOINT "mnt_point"
#define MNTPOINT "/data"

Choose a reason for hiding this comment

The 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.
.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.

#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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required.


struct testcase {
char *fname;
Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -124,10 +125,6 @@ static void setup(void)
static struct tst_test test = {
.tcnt = ARRAY_SIZE(testcases),
.needs_root = 1,
.mount_device = 1,

Choose a reason for hiding this comment

The 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.
.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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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,
};