aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2011-04-22fs-tests: integck: check deletion errors in rm_minus_rf_dirArtem Bityutskiy
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>
2011-04-22fs-tests: integck: introduce power cut testing argumentsArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not expect max name length to be 256Artem Bityutskiy
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>
2011-04-18fs-tests: integck: implement own version of CHECKArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use tests_random_noArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use global common variablesArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use tests_get_total_spaceArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use tests_remountArtem Bityutskiy
Implement our own version of 'tests_remount()' instead of depending on the common implementation. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: do not use tests_fs_is_rootfsArtem Bityutskiy
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>
2011-04-18fs-tests: integck: prefer to check for successArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use space after castArtem Bityutskiy
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>
2011-04-18fs-tests: integck: do not use tests_clear_dirArtem Bityutskiy
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>
2011-04-18fs-tests: integck: clean up test directory creationArtem Bityutskiy
Move the test directory name to the fsinfo structure and do few other cleanups while on it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: do not use tests_cat_pidArtem Bityutskiy
Do not use the shared 'tests_cat_pid' function but use a simple sprintf instead. This is another step to make integck independent of the common code. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: remove trailing backslashes from mount pointArtem Bityutskiy
The test is not working if the user specified mount point with a trailing back-slash at the end. Note, this had not worked before my changes as well. Fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: move log10_initial_free to fsinfoArtem Bityutskiy
Similarly to the previous patches, move the log10_initial_free variable to the fsinfo data structure. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: add own get_free_space functionArtem Bityutskiy
Do not use the shared 'tests_get_free_space' function but use own implementation instead. This is another step to make integck independent on the common infrastructure. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: move more variables to fsinfoArtem Bityutskiy
Aggregate all the information about the tested file-system in the fsinf object for better readability and cleanness. Move 'can_mmap' and 'check_nospc_files' there as well. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: move mem_page_size to fsinfoArtem Bityutskiy
The fsinfo structure will aggregate all the information about the tested file-system. Move 'mem_page_size' which we use for 'mmap()' there as well. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: make integck function return errorArtem Bityutskiy
Turn the 'void integck(void)' function into 'static int integck(void)'. We need to teach the test to gracefully handle some error cases like 'EROFS' instead of failing and exiting straight away. And the ground work for this is making all functions return errors. This is the first tiny step in this direction. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: get rid of tests_check_test_file_systemArtem Bityutskiy
Stop using the shared 'tests_check_test_file_system()' function but instead, use own independed version of this function. This is another step forward the goal to make integck independent of the common shared code. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: clean-up copy_stringArtem Bityutskiy
This is a clean-up patch which: 1. Simplifies copy_string by useng strdup instead of malloc 2. Adds an assertion which checks the input parameter agains NULL, instead of checking it. 3. Re-names it to dup_string which looks more readable to me. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: implement own parameters parsingArtem Bityutskiy
Instead of using shared command line arguments parsing routine implement own. The reason is that I want to add more parameters, which are integck-specific. Also, longer-term plan is to make integck independent of the common tests.c file. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: change tests defaultsArtem Bityutskiy
Currently integck assumes that by default the file-system cannot do shared writable mmap-ing and does not preserve accurate file size after ENOSPC errors. And then it overrides these default settings if this is UBIFS. But it seems that only JFFS2 has those limitations. So make the defaults to be the opposite and override them for JFFS2 only. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink write_info even moreArtem Bityutskiy
The 'struct write_info' data strucutre records information about truncation, and has a separate integer field to specify if this is a truncation or not. But it is too wasteful because we have huge amount of these objects. But it is easy to notice that the 'random_seed' field is not used for truncation records, so we can use that as the truncation flag. This patch introduces MAX_RANDOM_SEED macro and when the 'random_seed' field is greater than that, we treat it as the truncation flag. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: abuse random_offset field nicerArtem Bityutskiy
Currently integck uses the 'random_offset' filed to store the new file length sometimes, thus abusing this field. But we can do this nicer - introduce an anonymous union and add 'new_length' filed which will be used instead of 'random_offset' to make the code look nicer. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: srink file_info structure even moreArtem Bityutskiy
The 'check_run_no' field does not have to be 64-bit, it can be 32-bit instead and we can save 4 bytes per object. Actually, it could also be 16-bit, and we could make link_count 16-bit as well, but that would need a bit more work. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink file_info structure sizeArtem Bityutskiy
We do not have to store boolean flags in 'int' variables which consume 4 bytes each, we can store those in bit-fields instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-18fs-tests: integck: shrink dir_entry_info structure sizeArtem Bityutskiy
Turn "int checked" flag into 'char' flag to lessen memory consumption a bit. Indeed, the test allocates a lot of these data objects, so the size decrease from 36 to 32 bytes on 32-bit platforms is good to have. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: ubi-tests: clean libubi.a and *.oAndy Shevchenko
The common.mk contains clean target that removes *.o and $(TARGETS). Thus, make custom clean target only for libubi.a Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: checkfs: adjust MakefileAndy Shevchenko
This patch brings common Makefile (in terms of mtd-utils project) to the checkfs test suite. Additionally it fixes a build error related to usage of open(). Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-14tests: fs-tests: read() returns ssize_t valueAndy Shevchenko
Use ssize_t instead of size_t. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: use common printing macrosArtem Bityutskiy
Instead of using printf() directly, use the shared mtd-utils printing macros. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: include the common mtd-utils headerArtem Bityutskiy
Include the commong mtd-utils "common.h" header in integck test to make it possible to use shared macros. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: remove unnecessary checkArtem Bityutskiy
The 'link_new()' function has only one user, and the user checks that the third 'file' argument is non NULL, so remove this check from 'link_new()'. Let's be consistent and assume the 3rd argument is never NULL, just like the first and the second ones. This is just a minor improvement. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: simplify dir_entry_info fieldsArtem Bityutskiy
Instead of using named union 'entry' in 'struct dir_entry_info' and having to type long 'entry->entry.file', 'entry->entry.symlink', etc, use anonymous union which makes the syntax simpler: 'entry->file', 'entry->symlink', etc. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: do not cast void pointersArtem Bityutskiy
The malloc function returns 'void *', so it is not necessary to cast it when assigning. This is just a small clean-up patch. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-11fs-tests: integck: introduce zallocArtem Bityutskiy
The integck test often allocates memory and fills it with zeroes. Introduce a helper function for this frequent operation. This is just a clean-up patch which makes the code 23 lines shorter. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-09fs_tests: make the test-suite finish fasterArtem Bityutskiy
Currently the stress tests may run up to 1 hour, make the limit to be 6 minutes instead. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-07Makefile: introduce new target tests in MakefileAndy Shevchenko
This patch appends Makefile to the tests subdirectory and introduces tests target in the root Makefile. Additionally the clean target removes temporary stuff under tests subdirectory as well. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: jittertest: fix set of compiler warningsAndy Shevchenko
- time() was used without prototype. - the return value of read() and write() wasn't checked - classificator in printf() was wrong for argument of size_t type Don't continue to read the /proc/profile in case when write was failed. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: ubi-tests: seed_random_generator() was used w/o prototypeAndy Shevchenko
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: fs-tests: check return value of functionsAndy Shevchenko
chdir() returns negative value in case of error. fscanf() returns amount of successfully parsed parameters. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: checkfs: fix linker warningsAndy Shevchenko
The sys_errlist[errno] is deprecated. We should use strerror(errno) instead. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: checkfs: fix compiler warningsAndy Shevchenko
There are two warnings: - strlen() is used without prototype - argument of printf() is unsigned long, but used specifier is for int This patch fixes them. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-04-05tests: make jittertest buildableAndy Shevchenko
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-24fs-tests: integck: improve re-mounting test coverageArtem Bityutskiy
The integck tests re-mounts the file-system from time to time and checks the integrity afterwords. And it re-mounts always the same-way: unmount and then mount R/W back. However, it is better to do it differently some times, e.g.: * re-mount R/O then re-mount R/W * unmount then mount R/W * both of the above * unmount, mount R/O, then re-mount R/W * etc. This will give better test coverage. This patch does exactly that by improving the 'tests_remount()' function. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-24fs-tests: perf: fix compilation warningArtem Bityutskiy
Fix the following compilation warning: perf.c: In function ‘perf’: perf.c:144: warning: format ‘%lld’ expects type ‘long long int’, but argument 2 has type ‘int64_t’ by adding a (long long int) cast. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-03-24fs-tests: test_1: fix compilation warningsArtem Bityutskiy
Fix the following compilation warnings: test_1.c: In function ‘test_1’: test_1.c:67:4: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ test_1.c:88:3: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ The fix is to cast the argument with (unsigned long long). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-08-30mtd-utils: fix spelling errorBrian Norris
"fileds" is "fields" Signed-off-by: Brian Norris <norris@broadcom.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>