Age | Commit message (Collapse) | Author |
|
Teach 'add_dir_entry()' to allocate the file/dir/symlink object for
the client. This simplifies client's code. The only place where we
do not want to do this is when we are creating a hardling pointing
to an existing file.
Teach 'remove_dir_entry()' to free the file/dir/symlink object for
the client. Similarly, this simplifies client's code. The only place
where we do not want to do this is the rename function - when we
rename an object we want to only change its direntry, but not the
object itself.
But the main motivation for this change is not just to clean-up, but
to fix another memory leak. In the re-name function we free the
'rename_entry', but we did not free the corresponding object. This
patch fixes the situation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test forgets to free the args.mount_opts string on exit - fix this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
If the test runs in power-cut testing mode, do not exit in case of
EROFS error - but instead re-mount and start again.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Refuse to test the file-system if it is mounted Read-only.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We always pass non-NULL 'parent' argument to 'new_dir()', so no need to
test it for NULL.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
This patch kills the "name" field from 'struct file_info' where we stored
the original file name. We do not really need to keep this name around,
becaus it might have long gone and it is not very interesting. Besides,
we have several memory leaks where we leak 'file->name' strings, so this
is the easiest way to fix those leaks as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We do not need to store directory name in the 'struct dir_info' objects,
because we already have it in 'struct dir_entry_info'. So we duplicate
the names for directories in 'dir->name' and 'dir->entry->name'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'add_dir_entry()' consistent and allocate name for all types,
not only for 'd' and 's'. Also, since 'add_dir_entry()' sets the
parent - do not do this in the calling functions.
This is a clean-up which makes 'add_dir_entry()' more consistent.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When we create a symlink we also allocate a symlink_info structure
and the target path name. But when we remove a symlink - we do not
delete that memory. This patch fixes the issue.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test leaks memory like hell because it does not free the raw writes
information. This patch fixes the leaks.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
We have duplicated code for freeing write informatio - put it into
a helper function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not initialize dir->name because add_dir_entry already does
this for us, so we leak the memory.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When removing a directory and freeing corresponding 'dir_info' object -
do not forget to free directory name as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_truncate_file()' return an error to the caller if it fails
to open the file or to truncate it.
Additionally, check the error code from 'open()' in other places.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'file_open()' return an error to the caller if it fails to open
the file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'operate_on_entry()' handle handle errors from all functions
it calls and return the error code to the caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_unlink_file()' return an error to the caller if the
file cannot be unlinked.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'dir_remove()' to return an error to the caller if it fails to
remove the directory. Also, there was a memory leak - the 'path'
string was not freed - fix it as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
When 'symlink_remove()' fails to unling a symlink - return an error to
the calling function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'rename_entry()' return an error to the caller when it fails
to rename a directory entry.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'operate_on_dir()' functions propogate errors up if any of
the functions it calls failed. This patch also makes 'operate_on_entry()'
return an error code, but without actual implementation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_new()' to return -1 if it fails to create a file.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
There is a lot of code where %u is used for printing off_t variables,
which may be actually 64-bit wide. Fix this by using %llu.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The test sometimes uses "unsigned" and sometimes "unsigned int". This
patch makes the code more consistent by making it use "unsigned int"
everywhere.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Rename 'BUFFER_SIZE' constant into 'IO_BUFFER_SIZE' to reflect what
is the buffer this constant is about.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'file_write_data()' return an error in case of failure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_mmap_write()' to propagate failures up to the caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'operate_on_open_file()' to handle possible 'fsync()' and 'fdatasync()'
errors by returning -1 up to the caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_delete()' and several other functions it calls
(like 'file_unlink()) to handle write errors and propagate the
up to the caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'file_truncate()' return an error code in case of failure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'operate_on_open_file()', 'operate_on_an_open_file()', and
'do_an_operation()' propogate errors up.
Also move whole 'operate_on_file()' to a more logical place.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Make 'update_test_data()' and 'update_test_data()' check for errors
and return error in case of failure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Teach 'remount_tested_fs()' return error code when it fails
to mount the file-system.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not die in 'dir_new()' if it cannot create a new directory and
this is not because of ENOSPC. Return NULL for all errors.
Note, not all callers are ready to properly handle all errors so far.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Modify the 'rm_minus_rf_dir()' function to return -1 in case of any
errors during deletions. Make 'integck()' handle the errors. Also
introduce a 'pcv()' function to print error message if -v command
line option was specified.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Introduce new command line arguments for power cut testing:
-p to enable the power cut testing mode and -v to be verbose
about the errors. The real functionality is not implemented
so far.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
The 'make_name()' function assumes that the maxumum file name length
is 256 bytes, which is wrong. This patch fixes this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Remove the final dependency on the common code - the CHECK() macro.
Now we are finally independent. The reason we needed this is that
we are going to improve integck to handle errors more gracefully,
in order to support failure testing better. And this requires changes
in the common code, but it is ancient and shared by many tests, and
we do not want to touch it. So we better make integck independent
and concentrate on integck only.
This patch also removes Makefile dependencies. And while on it, remove
the broken 'tests' target.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not use the shared 'tests_random_no()' function but use our own
simple implementation instead. We do not need those rather complex
and difficult to understand computations.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not use the 'tests_file_system_mount_dir' and 'tests_file_system_type'
variables because we do not depend on them any longer.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not use the common tests_get_total_space but extend our own
get_free_space function and make it return both free and total
amount of space.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Implement our own version of 'tests_remount()' instead of depending
on the common implementation.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not use the shared 'tests_fs_is_rootfs()' function - introduce
'fsinfo.is_rootfs' flag and utilize it instead. This is another step
forward the goal to make integck independent of the common code.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Many of standard C libraries return 0 on success and -1 on failure.
Currently integck mostly checks for failure by comparing with -1, like:
CHECK(fsync(fd) != -1) /* Don't die if not failure */
but in some places the check is like
CHECK(fsync(fd) == 0) /* Don't die if success */
This patch harmonizes this an makes integck to use the second style
which seems to be more logical. Besides, the binary is smaller in
this case:
[dedekind@eru fs-tests (master)]$ size integrity/integck-old
text data bss dec hex filename
44677 1200 37408 83285 14555 integrity/integck
[dedekind@eru fs-tests (master)]$ size integrity/integck-new
text data bss dec hex filename
44661 1200 37408 83269 14545 integrity/integck
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Since we are kernel people lets use the style we are accustomed
to - no space between the cast and the variable: (type)a, not (type) a.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|
|
Do not use shared 'tests_clear_dir()' function which removes a directory
tree recursively, but instead use own implementation. This is because
I'm trying to make integck independend on the shared code because I
need this to do further improvements.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
|