summaryrefslogtreecommitdiff
path: root/tests/fs-tests
AgeCommit message (Collapse)Author
2011-06-25integck: fix build error (MS_DIRSYNC, MS_RELATIME)Brian Norris
Need to include <linux/fs.h>, at least for my build system. Otherwise, you can't build the 'tests'. integck.c: In function ‘parse_mount_options’: integck.c:2862: error: ‘MS_DIRSYNC’ undeclared (first use in this function) integck.c:2862: error: (Each undeclared identifier is reported only once integck.c:2862: error: for each function it appears in.) integck.c:2872: error: ‘MS_RELATIME’ undeclared (first use in this function) Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: add some more error messagesArtem Bityutskiy
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: print error message on errorArtem Bityutskiy
Currently pcv macro print the error message only if we are not doing power cut testing or if we have -v flag. But if we run without -v and an error happen and the error code is not EROFS/EIO, pcv() does not print anything. This patch makes it print the error message in that case as well. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: close files after creationArtem Bityutskiy
The 'file_new()' function should create a file but should not keep it open. There is a different path to open files and keep them open. This patch makes 'file_new()' close newly created files. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: make directory checking workArtem Bityutskiy
This patch makes the directory checking in case of power cut emulation actually work. There were many bugs. Basically, we cannot rely on anything unless the directory is marked as clean. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: add verbose reportingArtem Bityutskiy
Make -v switch control verbose integck output. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: always check clean dataArtem Bityutskiy
Check the clean data after every emulated power cut, not only when 'create_test_data()'/'update_test_data()' succeed. This required some minor re-work. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: introduce a helper function for dir syncArtem Bityutskiy
Add a helper 'sync_directory()' function to synchronize directories. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: print name of directory which we cannot openArtem Bityutskiy
In 'dir_check()' print name of the directory if we fail to open it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: EIO can also be return in power-cut testingArtem Bityutskiy
Currently when we are doing UBIFS power cut emulation testing we assume that EROFS is returned in case of an emulated power cut event. However, this is not true and sometimes Linux returns EIO to user-space instead. Namely, this happens when we are waiting for write-back to finish. Here is a call trace form kernel 2.6.39-rc7: Call Trace: [<ffffffff810aaa77>] filemap_write_and_wait_range+0x78/0xb1 [<ffffffff8110f34d>] vfs_fsync_range+0x38/0xd3 [<ffffffff8110f42b>] generic_write_sync+0x43/0x65 [<ffffffff810ab0c9>] generic_file_aio_write+0xaa/0xf2 [<ffffffffa02224c9>] ubifs_aio_write+0x13a/0x1a1 [ubifs] [<ffffffff810ed71f>] do_sync_write+0xcb/0x141 [<ffffffff810ee016>] vfs_write+0xb0/0x150 [<ffffffff810ee175>] sys_write+0x48/0x72 [<ffffffff813e0692>] system_call_fastpath+0x16/0x1b 'filemap_fdatawait_range()' returns hard-coded -EIO if a page write-back happens with whatever error code. Thus, this patch teaches integck to handle EIO when doing power cut emulation testing. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-27fs-tests: integck: implement MTD reattachingArtem Bityutskiy
This patch adds -m <mtdnum> option to integck and teaches integck to re-attach the MTD device to UBI in case of an emulated power cut event. This is needed for the new UBI power cut and unstable bits emulation infrastructure: when UBI emulates a power cut the only way to recover form this is to re-attach the MTD device. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: read all files in power cut modeArtem Bityutskiy
When we are in power cut mode read all files after re-mounting. This will check that FS recovery worked well and all files are readable after recovery. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: verify truncation only if -v option was givenArtem Bityutskiy
Currently we always verify holes when truncating, but we have -v switch for this and should do this only if -v was given. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: fsync directories as wellArtem Bityutskiy
Call 'fsync()' for directories sometimes as well, and check synchronized directories after re-mount - cound of directory entries has to be correct. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: return error if fsync failsArtem Bityutskiy
If 'fsync()' or 'fdatasync()' fail we have to return an error, but we by mistake were returning 0 (success). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: fsync more oftenArtem Bityutskiy
Currently integck calls 'fsync()' very rarely - with 0.1% probability. Make this happen more often - with 1% probability. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: verify clean filesArtem Bityutskiy
Allow verification for clean files, i.e. the files which had been fsync()'ed before the emulated power cut happened. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: make -v work -eArtem Bityutskiy
Make the verify option -v work with power cut emulation option -e. We can verify all operations except of writing to the file, because of write-back. Indeed, even if we write successfully, the pages may still be in the page-cache and if an emulated power cut happens they will be dropped, and our verification will fail. I am not 100% sure it is save to verify non-write operation in other FSes, but only UBIFS has power cut emulation mode now, so we do not really care about other FSes at this point. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: check direntries in power cut modeArtem Bityutskiy
Enable directory entry checking in power cut mode. This means that with this patch integck will check that all directory entries in the file-system were created by integck. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: check errno in pvc macroArtem Bityutskiy
All errors but write errors have corresponding CHECK(), so if something gets wrong we fail. But in case of I/O errors we do not fail if an unexpected error happens, which makes it difficult to trace issues. Inject the errno checking to the pvc macro to make sure we fail if errno is not EROFS. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: fix segfaultArtem Bityutskiy
Commit 1394a46213e8180e1233ca6d4811e7c77d49b1e0 was a good idea, but it introduced a segfault - files can be unlinked and 'file->links' is NULL, it is bad idea to unconditionally dereference it with 'file->links->name'. This patch introduces a helper function which takes care of the situation with unlinked files, plus it adds few assertions. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-05-20fs-tests: integck: introduce the clean flagArtem Bityutskiy
Introduce per-file "clean" flag which tells whether the file is synchronized or not. This flag is not really used so far. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-29fs-tests: integck: print error number in pcv messagesArtem Bityutskiy
In pcv() messages also print the error number - this is useful when an error happens and it is not because of EROFS. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-29fs-tests: integck: re-structure file_write a littleArtem Bityutskiy
This is just a preparation - re-structure 'file_write()' to make one "success" return point - we'll add synchronization stuff there. Also, while on it, make it delete the file errored in truncation, not only in write. Also, move the fsync() call to this function because it is common to all write paths. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-29fs-tests: integck: limit the recursion depthArtem Bityutskiy
I observes segfaults in integck test, and unfortunately I do not have the core file to investigate the problem. But I see one possibility for the test to segfault - it has unbounded recursion. Limit the maximum recursion depth. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-29fs-tests: integck: fail loudly on unexpected EROFSArtem Bityutskiy
If we are not in power cut testing mode (-p was not used) and we get an unexpected EROFS, we silently exit. This patch fixes this behavior and make the test loudly fail instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: fix falures with SIGBUSArtem Bityutskiy
The test sometimes dies due to SIGBUS because a power cut event happens when we are writing to an mmap()'ed area. SIGBUS is very difficult to ignore, so fix the issue simply by avoiding doing 'mmap()' operations when in power cut testing mode. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: ignore -e if in power cut modeArtem Bityutskiy
Similarly to the previous commit, do not verify operations when in power-cut testing mode. Again, this is because write-back may fail meanwhile. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: fix line number in CHECK() outputArtem Bityutskiy
In 'check_failed()' use the file and line number provided by the CHECK() macro via the function parameters, rather than using __LINE__ directly. Otherwise the funtion prints its own line, instead of the line where the CHECK() failed. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: do not run checking when in power cut modeArtem Bityutskiy
Do not check the file-system when we are in power cut mode. Currently we still check the FS if we did not encounter any error, and the test fails sometimes because meanwhile write-back encounters an error and drops pages. Disable the checking so far. It should be enabled when we implement the 'clean' flag for files. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-25fs-tests: integck: introduce a helper for checkingArtem Bityutskiy
Introduce a 'check_tested_fs()' helper function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: print a bit less if in power cut modeArtem Bityutskiy
Do not print extra messages when unable to re-mount - they are already printed by the recover function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: improve remountability logicArtem Bityutskiy
The integck test assumes that if the FS is rootfs then it cannot re-mount it, otherwise it can. However, this is not true because the tested FS can be not remountable even if it is not rootfs, e.g., if 'integck' lives on this FS and is executed from it. This patch improves the integck logic and actually checks wheter it is possible to re-mount the FS before starting the test. Also, it makes sure that power cut testing is run only on re-mountable FS, because we have to be able to clean the "corrupted" state of the file-system. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: re-mount always if not root fsArtem Bityutskiy
Commit 08cfd9d7cacc3c0b97530ad7e13fa8db75e99947 introduced a bug: we do not re-mount the FS before checking at the first iteration. This patch fixes the issue. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: make -v switch workArtem Bityutskiy
-v (verbose) switch is supposed to turn power cut testing error messages on/off. However, it does not work because the messages are printed even if -v was not specified. This patch fixes it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: use rand_r everywhereArtem Bityutskiy
Instead of using rand_r with own seed for operations and rand() with global state for data it is cleaner to use rand_r with own different states for these things. This patch eliminates 'srand()' and 'rand()' usage. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: use independent random generators for ops and dataArtem Bityutskiy
Currently integck uses the same global random generator for everything - for choosing the operation, generating the data, and for checking. This makes integck to become stuck sometimes. My guess this is because of we somehow re-set it back with srand() when checking files. This patch makes integck use different generators for data and for choosing operations by using rand_r() with own seed for operations. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: add debug compilation targetArtem Bityutskiy
I often need to use gdb to debug integck, or sometimes even attach already running integck. But when it is compiled with optimizations, it is nearly impossible to use gdb. Introduce 'debug' target to compile integck without optimizations. Additionally, to make the stack backtraces work, add a dirty hack to integck.c to remove all the static keywords - this turns static functions to non-static and makes them appear in stack backtraces. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: implement holes verificationArtem Bityutskiy
When -e option is used verify file holes after the truncate operation. Re-use the existing 'file_check_hole()' function for this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: implement data verificationArtem Bityutskiy
When -e options is used - verify written data. Re-use the existing file_check_data() function to implement this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: add -e option to verify operationsArtem Bityutskiy
Improve the test and add -e option which forces integck to verify all operation it performs. This patch does not implement file writes and holes operations so far - will be done in subsequent patches. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: print backtrace in case of failureArtem Bityutskiy
This patch teaches the 'CHECK()' macro to print the back-trace in case of failure which is sometimes very useful for debugging. This patch also adds a helper function for the 'CHECK()' macro because otherwise it becomes too large. Note, since all functions in the test are static, the stack trace does not really show symbols. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: do not inlcude lib directoryArtem Bityutskiy
The integck test does not depend on the "common" directory any more, so we do not have to have -I ../lib for compilation. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-24fs-tests: integck: improve help messageArtem Bityutskiy
Fix typos, make it a bit more descriptive. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-22fs-tests: integck: make power cut mode workArtem Bityutskiy
This is a dirty patch - it makes many changes, but I simply had no time to split it. And because this test is something no one except me and Adrian cares about, I do not want to spend too much time creating nice patches. Anyway, this patch make the power cut testing mode work. Now you can run the test like "./integck /mnt/ubifs -p" and it will run recover from emulated power cut failures and continue forever, untill an unexpected issue is met. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-22fs-tests: integck: remove unneeded \nArtem Bityutskiy
The 'errmsg()' macro adds "\n" at the end, so do not use it in our 'pcv()' and 'CHECK()' macros. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-22fs-tests: integck: do not assume the FS is mounted after failureArtem Bityutskiy
If a power cut emulation error happens and we are trying to re-mount the file-system, do not assume it is mounted because the failure could have happened after it had had been unmounted but before it was successfully mounted. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-22fs-tests: integck: add recovery remounting functionArtem Bityutskiy
When re-mountig to recover from the emulated power-cut failure then we should do a bit less fancy things, e.g., we should not try to re-mount to R/O and R/W modes forth and back, but we should instead just unmount directly. Additionally, we should not die if mount fails because there may be a power cut emulation during mounting. Thus, create a separate function for recovering and try to recover in a loop. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-22fs-tests: integck: simplify dirent manipulationArtem Bityutskiy
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>
2011-04-22fs-tests: integck: do not forget to free mount_optsArtem Bityutskiy
The test forgets to free the args.mount_opts string on exit - fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>