Commit Graph

175 Commits

Author SHA1 Message Date
Yury V. Zaytsev f0414be51d Zero struct stat tv_nsec (if supported) whenever st is filled manually
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Mooffie e2f5034303 Ticket #3786: extfs: rpm: fix test's "expected output".
As will be explained in a following commit, our rpm helper has a bug stemming
from the use of 'echo'.

Before we fix it, we update the test's "expected output" to reflect the
intended output (as it's currently reflects a faulty output).

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-09 01:03:34 +02:00
Mooffie d0131271f3 Ticket #3787: extfs: tests for helpers using 'sort' may fail.
The "expected output" files we provide must be generated in the same locale the
tester (that is, the helpers) are run. Otherwise helpers using the 'sort'
utility may generate output different than our provided "expected output",
hence failing the tests.

Therefore we:

(1) Regenerate the "expected output" files in the C locale.

(2) Make sure the tester is run in the C locale.

(Tip: to regenerate the "expected output" files we deleted all the *.output
files and run the tester with "LC_ALL=C ./run --create-output".)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-08 14:01:46 +02:00
Mooffie f782b037d8 extfs: tester: fix indentation.
No code is modified here. Only whitespace.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-08 11:34:09 +02:00
Mooffie 55624eae3b Ticket #3784: extfs: add diff output to tester.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-03-07 23:57:35 +02:00
Yury V. Zaytsev ab4fcb6d30 Revert "Ticket #3687: store the 'hotlist' file in data dir, not config dir."
This reverts commit 306b30ed30.
2017-02-24 21:32:01 +01:00
Andrew Borodin e9fd11bfcd Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Mooffie 65299b8310 extfs: rpm: fix tests for transaction scripts.
We update our .output file to include the entries
`INFO/SCRIPTS/{PRE,POST}TRANS[PROG]`, which the rpm helper now emits.

(Tip: here's how we do this: we delete the output file and recreate it by
running the tester thus: "./run --create-output".)

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 17:14:38 +02:00
Mooffie a3b9b95c2d extfs: rpm: move misc/* to misc/rpm/*.
In the future we will probably place each helper's tests in a separate folder.
We'll then get rid of this 'misc/rpm' folder by moving it there.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie b10f34e898 extfs: rpm: add test for a custom package.
We use a 'spec' contributed by Jiri Tyr.

We keep the previous test (by renaming rpm.* to rpm.glib.*), though, in case
somebody wants to work on data from "the real world".

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie 4b8785ead6 extfs: rpm: add tests.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie e3cef7576b extfs: rpm: introduce the rpm2tags tool.
This is a preliminary step before being able to write tests for our rpm helper.

We introduce 'rpm2tags', a tool for converting RPM packages to parsable text
files. This will enable us to write tests that can run even where the 'rpm'
program isn't installed.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-16 13:58:07 +02:00
Mooffie 69897e94fd Ticket #3753: extfs: tester: let test scripts easily access configure-time parameters.
We introduce a mechanism by which tests can easily access configure-time
parameters (like @PERL@, @AWK@, ...).

It works by "sourcing" a file named config.sh (residing in the build tree):

    . "$MC_TEST_EXTFS_CONFIG_SH"
    $PERL -e 'print "hello"'

(Although config.sh has a shell syntax, Perl and Python programs too can
benefit from it, because it can be sourced into an .env_vars file and the
values exported from there.)

Of course, one can also use the traditional method, of *.in files listed in
configure.ac, but the mechanism introduced here is a more comfortable approach.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-15 20:10:01 +02:00
Mooffie f42bdb1261 extfs: tester: improve HTML documentation output.
- We now have 4'th level headers: adjust --doc-depth.
- We have many short sections: highlight the active section's header.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-15 19:43:45 +02:00
Mooffie e4e4b214b4 extfs: tester: export some more useful variables.
New environment variables:

- MC_TEST_EXTFS_DATA_DIR
- MC_TEST_EXTFS_INPUT

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-15 19:43:40 +02:00
Mooffie 9f99838fbe Ticket #3752: extfs: tester: use lowercase for private variables.
We switch to a modern practice of using lowercase for private variables ("shell
variables") and uppercase for the system's ("environment variables"). Constants
too are made lowercase, as it takes a philosopher to define "constant".

This gives us two advantages:

- If an .env_vars file accesses a private variable (e.g. $DATA_DIR or $INPUT),
  something we want to discourage, we'll easily see this.

- Somewhat confusing code like "MC_TEST_DATA_DIR=$DATA_DIR" (which was to occur
  in the following patch) becomes self-documenting after the change.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-13 15:36:18 +02:00
Andrew Borodin aae43d362f (vfs_adjust_stat): new VFS API, currently used to calculate st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin bf40acf420 Clarify usage of st_rdev. Use it if HAVE_STRUCT_STAT_ST_RDEV is defined.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin 7e4a59e8d6 Clarify usage of st_blocks. Use it if HAVE_STRUCT_STAT_ST_BLOCKS is defined.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Andrew Borodin 8dabd9ac2a Ticket #3749: fix segfault in VFS if block size is not set.
Initial commit: clarify usage of st_blksize. Use it if
HAVE_STRUCT_STAT_ST_BLKSIZE is defined.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-11 14:52:35 +03:00
Mooffie 4a559344fb Ticket #3708: fix usability problems with `--enable-tests`
Signed-off-by: Mooffie <mooffie@gmail.com>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-12-27 16:46:38 +04:00
Mooffie d376f0ca43 extfs: hp48: add tests. 2016-12-25 10:06:23 +04:00
Mooffie 644682ad2c extfs: uarc: add tests. 2016-12-25 10:06:23 +04:00
Mooffie 0e4e80cf79 extfs: uace: add tests. 2016-12-25 10:06:23 +04:00
Mooffie d4ec872f37 Ticket #3744: extfs: u7z: add tests. 2016-12-24 09:58:53 +04:00
Mooffie 2c17c7d28b Ticket #3730: extfs: don't run tester on "make check" if disabled.
If the extfs VFS is disabled, there's no point in building and running the
tester.

(The "SUBDIRS =" line isn't needed, but it looks tidier this way, especially if
we later add subdirs for testing the other VFSs.)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-20 09:37:03 +03:00
Andrew Borodin 455316be9f tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c: fix warning:
tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c: In function 'string_date':
tests/src/vfs/extfs/helpers-list/mc_parse_ls_l.c:193:21: warning:
declaration of 'time' shadows a global declaration [-Wshadow]

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-19 13:26:48 +03:00
Andrew Borodin 84cbca51af tests/src/vfs/extfs/helpers-list/Makefile.am: create run silently.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-19 09:39:48 +03:00
Andrew Borodin 9764511b08 Move extfs tester from tests/src/extfs-helpers-listcmd into tests/src/vfs/extfs/helpers-list.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-19 09:39:15 +03:00
Mooffie 96313b16bc extfs: lslR: add tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie eded16b0e9 extfs: urar: add tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie 5f4387cafb extfs: uzip: add tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-16 10:14:41 +03:00
Mooffie 849d3e8f9d extfs: uzoo: add tests.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-14 13:15:58 +03:00
Mooffie a45c997696 extfs: documentation for the tester.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-14 13:15:58 +03:00
Mooffie 7a3891eb90 extfs: introduce a tester.
This tester tests that helpers implement the "list" command correctly.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-14 13:15:58 +03:00
Mooffie 13a805bd79 Ticket #3730: extfs: introduce a command-line tool for parsing file lists.
We introduce 'mc_parse_ls_l', a tool for parsing file-listings in format
similar to that of 'ls -l'. This format is used by the various extfs helpers.

We'll use this tool, in the next commit, to build a tester.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-14 13:15:29 +03:00
Mooffie 7be9334e45 Fix quotes handling.
Note: considering that this feature hasn't worked, we may consider removing it
entirely or partially (e.g., escaping) in order to simplify the code, as nobody
has grown used to it. It seems, based on the "hex mode" mentioned in the manual
page, that in the past there was no "normal" search in hex mode, and quoted
strings were the only easy way to look for text. This is no longer the case
nowadays.

Note: the characters in the quoted string are copied out as-is to the regexp.
No regexp-quoting is currently done. We may want to revisit this issue when we
work on ticket #3695.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie 64e6ccef7f Handle invalid characters.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie cc8fcdcfc0 Fix trailing whitespace problem.
sscanf() returns EOF when it reaches the end of the string. Our code
erroneously interprets this as if a number was read. The fix: we test for an
explicit '1'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:27 +03:00
Mooffie b25af93874 Report errors to the user.
Instead of silently accepting invalid patterns, we notify the user of errors.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:55:26 +03:00
Mooffie 3332d1ebe4 Ticket #3694: fix hex pattern parsing.
Add test for mc_search__hex_translate_to_regex().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:54:43 +03:00
Mooffie 306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin 2356acc26d NULL-ize some variables to make unit tests happy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin 2151edaff2 Get rid of global variables mc_main_config and mc_panels_config.
Use mc_global.main_config and mc_global.panels_congig instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr eef076cef6 cppcheck: Cleanup Passing NULL after the last typed argument warning
Cleanup Passing NULL after the last typed argument warning.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Yury V. Zaytsev a8f512c12c Remove unneeded `struct` keyword for typedef'd structs
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-03-04 09:23:38 +03:00
Andrew Borodin a52cb840ae (tree_chdir, sync_tree): take vfs_path_t object to avoid double conversion of path.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:37 +03:00
Andreas Mohr 7146508b31 Cleanup: usermenu.c: use const edit_widget.
Use const because edit_widget not altered in these functions.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:37 +03:00
Andrew Borodin dd60bf40dc (get_random_hint): modify time measurement.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:36 +03:00
Andrew Borodin 6f5fc5d528 (get_random_hint): move to src/filemanager/midnight.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-03-04 09:23:36 +03:00