.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Config::Model::Tester 3pm" .TH Config::Model::Tester 3pm "2017-06-01" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Config::Model::Tester \- Test framework for Config::Model .SH "VERSION" .IX Header "VERSION" version 2.062 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& # in t/model_test.t \& use warnings; \& use strict; \& \& use Config::Model::Tester ; \& use ExtUtils::testlib; \& \& my $arg = shift || \*(Aq\*(Aq; # typically e t l \& my $test_only_app = shift || \*(Aq\*(Aq; # only run one set of test \& my $do = shift ; # select subtests to run with a regexp \& \& run_tests($arg, $test_only_app, $do) ; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides a way to test configuration models with tests files. This class was designed to tests several models and several tests cases per model. .PP A specific layout for test files must be followed. .SS "Test specification" .IX Subsection "Test specification" Each set of test is defined in a file like: .PP .Vb 1 \& t/model_tests.d/\-test\-conf.pl .Ve .PP This file specifies that \f(CW\*(C`app\-name\*(C'\fR (which is defined in \&\f(CW\*(C`lib/Config/Model/*.d\*(C'\fR directory) will be used for the test cases defined in the \f(CW\*(C`*\-test\-conf.pl\*(C'\fR file. .PP This file contains a list of test case (explained below) and expects a set of files used as test data. The layout of these test data files is explained in next section. .SS "Simple test file layout" .IX Subsection "Simple test file layout" Each test case is represented by a configuration file (not a directory) in the \f(CW\*(C`*\-examples\*(C'\fR directory. This configuration file will be used by the model to test and is copied as \&\f(CW\*(C`$confdir/$conf_file_name\*(C'\fR using the global variables explained below. .PP In the example below, we have 1 app model to test: \f(CW\*(C`lcdproc\*(C'\fR and 2 tests cases. The app name matches the file specified in \&\f(CW\*(C`lib/Config/Model/*.d\*(C'\fR directory. In this case, the app name matches \&\f(CW\*(C`lib/Config/Model/system.d/lcdproc\*(C'\fR .PP .Vb 7 \& t \& |\-\- model_test.t \& \e\-\- model_tests.d # do not change directory name \& |\-\- lcdproc\-test\-conf.pl # test specification for lcdproc app \& \e\-\- lcdproc\-examples \& |\-\- t0 # subtest t0 \& \e\-\- LCDD\-0.5.5 # subtest for older LCDproc .Ve .PP Test specification is written in \f(CW\*(C`lcdproc\-test\-conf.pl\*(C'\fR file (i.e. this modules looks for files named like \f(CW\*(C`\-test\-conf.pl>\*(C'\fR). .PP Subtests data is proviced in files in directory \f(CW\*(C`lcdproc\-examples\*(C'\fR ( i.e. this modules looks for test data in directory \&\f(CW\*(C`\-examples>\*(C'\fR. \f(CW\*(C`lcdproc\-test\-conf.pl\*(C'\fR contains instructions so that each file will be used as a \f(CW\*(C`/etc/LCDd.conf\*(C'\fR file during each test case. .PP \&\f(CW\*(C`lcdproc\-test\-conf.pl\*(C'\fR can contain specifications for more test cases. Each test case requires a new file in \f(CW\*(C`lcdproc\-examples\*(C'\fR directory. .PP See \*(L"Examples\*(R" for a link to the actual LCDproc model tests .SS "Test file layout for multi-file configuration" .IX Subsection "Test file layout for multi-file configuration" When a configuration is spread over several files, each test case is provided in a sub-directory. This sub-directory is copied in \&\f(CW$conf_dir\fR (a global variable as explained below) .PP In the example below, the test specification is written in \&\f(CW\*(C`dpkg\-test\-conf.pl\*(C'\fR. Dpkg layout requires several files per test case. \&\f(CW\*(C`dpkg\-test\-conf.pl\*(C'\fR will contain instructions so that each directory under \f(CW\*(C`dpkg\-examples\*(C'\fR will be used. .PP .Vb 10 \& t/model_tests.d \& \e\-\- dpkg\-test\-conf.pl # test specification \& \e\-\- dpkg\-examples \& \e\-\- libversion # example subdir, used as subtest name \& \e\-\- debian # directory for one test case \& |\-\- changelog \& |\-\- compat \& |\-\- control \& |\-\- copyright \& |\-\- rules \& |\-\- source \& | \e\-\- format \& \e\-\- watch .Ve .PP See \*(L"Examples\*(R" for a link to the (many) Dpkg model tests .SS "More complex file layout" .IX Subsection "More complex file layout" Each test case is a sub-directory on the \f(CW\*(C`*\-examples\*(C'\fR directory and contains several files. The destination of the test files may depend on the system (e.g. the \s-1OS\s0). For instance, system wide \f(CW\*(C`ssh_config\*(C'\fR is stored in \f(CW\*(C`/etc/ssh\*(C'\fR on Linux, and directly in \f(CW\*(C`/etc\*(C'\fR on MacOS. .PP These files are copied in a test directory using a \f(CW\*(C`setup\*(C'\fR parameter: .PP .Vb 3 \& setup => { \& test_file_in_example_dir => \*(Aqdestination\*(Aq \& } .Ve .PP Let's consider this example of 2 tests cases for ssh: .PP .Vb 6 \& t/model_tests.d/ \& |\-\- ssh\-test\-conf.pl \& |\-\- ssh\-examples \& \e\-\- basic \& |\-\- system_ssh_config \& \e\-\- user_ssh_config .Ve .PP Unfortunately, \f(CW\*(C`user_ssh_config\*(C'\fR is a user file, so you specify where the home directory for the tests with another global variable: .PP .Vb 1 \& $home_for_test = \*(Aq/home/joe\*(Aq ; .Ve .PP For Linux only, the \f(CW\*(C`setup\*(C'\fR parameter is: .PP .Vb 4 \& setup => { \& \*(Aqsystem_ssh_config\*(Aq => \*(Aq/etc/ssh/ssh_config\*(Aq, \& \*(Aquser_ssh_config\*(Aq => "~/.ssh/config" \& } .Ve .PP On the other hand, system wide config file is different on MacOS and the test file must be copied in the correct location. When the value of the \f(CW\*(C`setup\*(C'\fR hash is another hash, the key of this other hash is used as to specify the target location for other \s-1OS \s0(as returned by Perl \f(CW$^O\fR variable: .PP .Vb 7 \& setup => { \& \*(Aqsystem_ssh_config\*(Aq => { \& \*(Aqdarwin\*(Aq => \*(Aq/etc/ssh_config\*(Aq, \& \*(Aqdefault\*(Aq => \*(Aq/etc/ssh/ssh_config\*(Aq, \& }, \& \*(Aquser_ssh_config\*(Aq => "~/.ssh/config" \& } .Ve .PP See the actual Ssh and Sshd model tests .SS "Basic test specification" .IX Subsection "Basic test specification" Each model test is specified in \f(CW\*(C`\-test\-conf.pl\*(C'\fR. This file contains a set of global variables. (yes, global variables are often bad ideas in programs, but they are handy for tests): .PP .Vb 6 \& # config file name (used to copy test case into test wr_root directory) \& $conf_file_name = "fstab" ; \& # config dir where to copy the file (optional) \& #$conf_dir = "etc" ; \& # home directory for this test \& $home_for_test = \*(Aq/home/joe\*(Aq ; .Ve .PP Here, \f(CW\*(C`t0\*(C'\fR file will be copied in \f(CW\*(C`wr_root/test\-t0/etc/fstab\*(C'\fR. .PP .Vb 2 \& # config model name to test \& $model_to_test = "Fstab" ; \& \& # list of tests. This modules looks for @tests global variable \& @tests = ( \& { \& # test name \& name => \*(Aqt0\*(Aq, \& # add optional specification here for t0 test \& }, \& { \& name => \*(Aqt1\*(Aq, \& # add optional specification here for t1 test \& }, \& ); \& \& 1; # to keep Perl happy .Ve .PP You can suppress warnings by specifying \f(CW\*(C`no_warnings => 1\*(C'\fR. On the other hand, you may also want to check for warnings specified to your model. In this case, you should avoid specifying \f(CW\*(C`no_warnings\*(C'\fR here and specify warning tests or warning filters as mentioned below. .PP See actual fstab test . .SS "Internal tests or backend tests" .IX Subsection "Internal tests or backend tests" Some tests will require the creation of a configuration class dedicated for test (typically to test corner cases on a backend). .PP This test class can be created directly in the test specification by calling create_config_class on \&\f(CW$model\fR variable. See for instance the layer test or the test for shellvar backend . .SS "Test specification with arbitrary file names" .IX Subsection "Test specification with arbitrary file names" In some models like \f(CW\*(C`Multistrap\*(C'\fR, the config file is chosen by the user. In this case, the file name must be specified for each tests case: .PP .Vb 2 \& # not needed if test file is named multistrap\-test\-conf.pl \& $model_to_test = "Multistrap"; \& \& @tests = ( \& { \& name => \*(Aqarm\*(Aq, \& config_file => \*(Aq/home/foo/my_arm.conf\*(Aq, \& check => {}, \& }, \& ); .Ve .PP See the actual multistrap test . .SS "Backend argument" .IX Subsection "Backend argument" Some application like systemd requires a backend argument specified by User (e.g. a service name for systemd). The parameter \f(CW\*(C`backend_arg\*(C'\fR can be specified to emulate this behavior. .SS "Re-use test data" .IX Subsection "Re-use test data" When the input data for test is quite complex (several files), it may be interested to re-use these data for other tests case. Knowing that test name must must unique, you can re-use test data with \f(CW\*(C`data_from\*(C'\fR parameter. For instance: .PP .Vb 10 \& @tests = ( \& { \& name => \*(Aqsome\-test\*(Aq, \& # ... \& }, \& { \& name => \*(Aqsome\-other\-test\*(Aq, \& data_from => \*(Aqsome\-test\*(Aq, # re\-use data from test above \& # ... \& }, .Ve .PP See plainfile backend test for a real life example. .SS "Test scenario" .IX Subsection "Test scenario" Each subtest follow a sequence explained below. Each step of this sequence may be altered by adding specification in \&\f(CW\*(C`\-test\-conf.pl\*(C'\fR: .IP "\(bu" 4 Setup test in \f(CW\*(C`wr_root//\*(C'\fR. If your configuration file layout depend on the target system, you will have to specify the path using \f(CW\*(C`setup\*(C'\fR parameter. See \*(L"Test file layout depending on system\*(R". .IP "\(bu" 4 Create configuration instance, load config data and check its validity. Use \&\f(CW\*(C`load_check => \*(Aqno\*(Aq\*(C'\fR if your file is not valid. .IP "\(bu" 4 Check for config data warning. You should pass the list of expected warnings. E.g. .Sp .Vb 1 \& load_warnings => [ qr/Missing/, (qr/deprecated/) x 3 , ], .Ve .Sp Use an empty array_ref to mask load warnings. .IP "\(bu" 4 Optionally run update command: .Sp .Vb 6 \& update => { \& [ returns => \*(Aqfoo\*(Aq , ] \& no_warnings => [ 0 | 1 ], # default 0 \& quiet => [ 0 | 1], # default 0, passed to update method \& update_warnings => [ qr/.../, ] \& } .Ve .Sp Where: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`returns\*(C'\fR is the expected return value (optional). .IP "\(bu" 4 \&\f(CW\*(C`no_warnings\*(C'\fR to suppress the warnings coming from Config::Model::Value. Note that \f(CW\*(C`no_warnings => 1\*(C'\fR may be useful for less verbose test. .IP "\(bu" 4 \&\f(CW\*(C`quiet\*(C'\fR to suppress progress messages during udpate. .IP "\(bu" 4 \&\f(CW\*(C`update_warnings\*(C'\fR is an array ref of quoted regexp (See qr operator) to check the warnings produced during update. use \f(CW\*(C`update => []\*(C'\fR to check that no warnings are issued during udpate. .RE .RS 4 .Sp All other arguments are passed to \f(CW\*(C`update\*(C'\fR method. .RE .IP "\(bu" 4 Optionally load configuration data. You should design this config data to suppress any error or warning mentioned above. E.g: .Sp .Vb 1 \& load => \*(Aqbinary:seaview Synopsis="multiplatform interface for sequence alignment"\*(Aq, .Ve .Sp See Config::Model::Loader for the syntax of the string accepted by \f(CW\*(C`load\*(C'\fR parameter. .IP "\(bu" 4 Optionally, run a check before running apply_fix (if any). This step is useful to check warning messages: .Sp .Vb 4 \& check_before_fix => { \& dump_errors => [ ... ] # optional, see below \& dump_warnings => [ ... ] # optional, see below \& } .Ve .Sp Use \f(CW\*(C`dump_errors\*(C'\fR if you expect issues: .Sp .Vb 7 \& check_before_fix => { \& dump_errors => [ \& # the issues and a way to fix the issue using Config::Model::Node::load \& qr/mandatory/ => \*(AqFiles:"*" Copyright:0="(c) foobar"\*(Aq, \& qr/mandatory/ => \*(Aq License:FOO text="foo bar" ! Files:"*" License short_name="FOO" \*(Aq \& ], \& } .Ve .Sp Likewise, specify any expected warnings (note the list must contain only ref to regular expressions): .Sp .Vb 3 \& check_before_fix => { \& dump_warnings => [ (qr/deprecated/) x 3 ], \& } .Ve .Sp You can tolerate any dump warning this way: .Sp .Vb 3 \& check_before_fix => { \& dump_warnings => undef , \& } .Ve .Sp Both \f(CW\*(C`dump_warnings\*(C'\fR and \f(CW\*(C`dump_errors\*(C'\fR can be specified in \f(CW\*(C`check_before_fix\*(C'\fR hash. .IP "\(bu" 4 Optionally, call apply_fixes: .Sp .Vb 1 \& apply_fix => 1, .Ve .IP "\(bu" 4 Call dump_tree to check the validity of the data after optional \f(CW\*(C`apply_fix\*(C'\fR. This step is not optional. .Sp As with \f(CW\*(C`check_before_fix\*(C'\fR, both \f(CW\*(C`dump_errors\*(C'\fR or \f(CW\*(C`dump_warnings\*(C'\fR can be used. .IP "\(bu" 4 Run specific content check to verify that configuration data was retrieved correctly: .Sp .Vb 5 \& check => { \& \*(Aqfs:/proc fs_spec\*(Aq, "proc" , \& \*(Aqfs:/proc fs_file\*(Aq, "/proc" , \& \*(Aqfs:/home fs_file\*(Aq, "/home", \& }, .Ve .Sp The keys of the hash points to the value to be checked using the syntax described in \*(L"grab(...)\*(R" in Config::Model::AnyThing:. .Sp You can run check using different check modes (See \*(L"fetch( ... )\*(R" in Config::Model::Value) by passing a hash ref instead of a scalar : .Sp .Vb 4 \& check => { \& \*(Aqsections:debian packages:0\*(Aq , { mode => \*(Aqlayered\*(Aq, value => \*(Aqdpkg\-dev\*(Aq }, \& \*(Aqsections:base packages:0\*(Aq, { mode => \*(Aqlayered\*(Aq, value => "gcc\-4.2\-base\*(Aq }, \& }, .Ve .Sp The whole hash content (except \*(L"value\*(R") is passed to grab and fetch .Sp A regexp can also be used to check value: .Sp .Vb 4 \& check => { \& "License text" => qr/gnu/i, \& "License text" => { mode => \*(Aqcustom\*(Aq, value => qr/gnu/i }, \& } .Ve .IP "\(bu" 4 Verify if a hash contains one or more keys (or keys matching a regexp): .Sp .Vb 6 \& has_key => [ \& \*(Aqsections\*(Aq => \*(Aqdebian\*(Aq, # sections must point to a hash element \& \*(Aqcontrol\*(Aq => [qw/source binary/], \& \*(Aqcopyright Files\*(Aq => qr/.c$/, \& \*(Aqcopyright Files\*(Aq => [qr/\e.h$/], qr/\e.c$/], \& ], .Ve .IP "\(bu" 4 Verify that a hash has \fBnot\fR a key (or a key matching a regexp): .Sp .Vb 3 \& has_not_key => [ \& \*(Aqcopyright Files\*(Aq => qr/.virus$/ # silly, isn\*(Aqt ? \& ], .Ve .IP "\(bu" 4 Verify annotation extracted from the configuration file comments: .Sp .Vb 4 \& verify_annotation => { \& \*(Aqsource Build\-Depends\*(Aq => "do NOT add libgtk2\-perl to build\-deps (see bug #554704)", \& \*(Aqsource Maintainer\*(Aq => "what a fine\enteam this one is", \& }, .Ve .IP "\(bu" 4 Write back the config data in \f(CW\*(C`wr_root//\*(C'\fR. Note that write back is forced, so the tested configuration files are written back even if the configuration values were not changed during the test. .Sp You can skip warning when writing back with the global : .Sp .Vb 1 \& no_warnings => 1, .Ve .IP "\(bu" 4 Check the content of the written files(s) with Test::File::Contents. Tests can be grouped in an array ref: .Sp .Vb 4 \& file_contents => { \& "/home/foo/my_arm.conf" => "really big string" , \& "/home/bar/my_arm.conf" => [ "really big string" , "another"], , \& } \& \& file_contents_like => { \& "/home/foo/my_arm.conf" => [ qr/should be there/, qr/as well/ ] , \& } \& \& file_contents_unlike => { \& "/home/foo/my_arm.conf" => qr/should NOT be there/ , \& } .Ve .IP "\(bu" 4 Check the mode of the written files: .Sp .Vb 4 \& file_mode => { \& "~/.ssh/ssh_config" => 0600, # octal mode \& "debian/stuff.postinst" => 0755, \& } .Ve .Sp Only the last four octets of the mode are tested. I.e. the test is done with \&\f(CW\*(C` $file_mode & 07777 \*(C'\fR .Sp Note: this test is skipped on Windows .IP "\(bu" 4 Check added or removed configuration files. If you expect changes, specify a subref to alter the file list: .Sp .Vb 5 \& file_check_sub => sub { \& my $list_ref = shift ; \& # file added during tests \& push @$list_ref, "/debian/source/format" ; \& }, .Ve .Sp Note that actual and expected file lists are sorted before check, adding a file can be done with \f(CW\*(C`push\*(C'\fR. .IP "\(bu" 4 Copy all config data from \f(CW\*(C`wr_root//\*(C'\fR to \f(CW\*(C`wr_root/\-w/\*(C'\fR. This steps is necessary to check that configuration written back has the same content as the original configuration. .IP "\(bu" 4 Create a second configuration instance to read the conf file that was just copied (configuration data is checked.) .IP "\(bu" 4 You can skip the load check if the written file still contain errors (e.g. some errors were ignored and cannot be fixed) with \f(CW\*(C`load_check2 => \*(Aqno\*(Aq\*(C'\fR .IP "\(bu" 4 Optionally load configuration data in the second instance. You should design this config data to suppress any error or warning that occur in the step below. E.g: .Sp .Vb 1 \& load2 => \*(Aqbinary:seaview\*(Aq, .Ve .Sp See Config::Model::Loader for the syntax of the string accepted by \f(CW\*(C`load2\*(C'\fR parameter. .IP "\(bu" 4 Compare data read from original data. .IP "\(bu" 4 Run specific content check on the \fBwritten\fR config file to verify that configuration data was written and retrieved correctly: .Sp .Vb 5 \& wr_check => { \& \*(Aqfs:/proc fs_spec\*(Aq => "proc" , \& \*(Aqfs:/proc fs_file\*(Aq => "/proc", \& \*(Aqfs:/home fs_file\*(Aq => "/home", \& }, .Ve .Sp Like the \f(CW\*(C`check\*(C'\fR item explained above, you can run \f(CW\*(C`wr_check\*(C'\fR using different check modes. .SS "Running the test" .IX Subsection "Running the test" Run all tests with one of these commands: .PP .Vb 2 \& prove \-l t/model_test.t :: [ t|l|e [ [ ]]] \& perl \-Ilib t/model_test.t [ t|l|e [ [ ]]] .Ve .PP By default, all tests are run on all models. .PP You can pass arguments to \f(CW\*(C`t/model_test.t\*(C'\fR: .IP "\(bu" 4 a bunch of letters. 't' to get test traces. 'e' to get stack trace in case of errors, 'l' to have logs. All other letters are ignored. E.g. .Sp .Vb 2 \& # run with log and error traces \& prove \-lv t/model_test.t :: el .Ve .IP "\(bu" 4 The model name to tests. E.g.: .Sp .Vb 2 \& # run only fstab tests \& prove \-lv t/model_test.t :: x fstab .Ve .IP "\(bu" 4 A regexp to filter subtest E.g.: .Sp .Vb 2 \& # run only fstab tests foobar subtest \& prove \-lv t/model_test.t :: x fstab foobar \& \& # run only fstab tests foo subtest \& prove \-lv t/model_test.t :: x fstab \*(Aq^foo$\*(Aq .Ve .SH "Examples" .IX Header "Examples" .IP "\(bu" 4 LCDproc has a single configuration file: \&\f(CW\*(C`/etc/LCDd.conf\*(C'\fR. Here's LCDproc test layout and the test specification .IP "\(bu" 4 Dpkg packages are constructed from several files. These files are handled like configuration files by Config::Model::Dpkg. The test layout features test with multiple file in dpkg-examples . The test is specified in dpkg\-test\-conf.pl .IP "\(bu" 4 multistrap\-test\-conf.pl and multistrap-examples specify a test where the configuration file name is not imposed by the application. The file name must then be set in the test specification. .IP "\(bu" 4 backend\-shellvar\-test\-conf.pl is a more complex example showing how to test a backend. The test is done creating a dummy model within the test specification. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Config::Model .IP "\(bu" 4 Test::More .SH "AUTHOR" .IX Header "AUTHOR" Dominique Dumont .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2013\-2017 by Dominique Dumont. .PP This is free software, licensed under: .PP .Vb 1 \& The GNU Lesser General Public License, Version 2.1, February 1999 .Ve .SH "SUPPORT" .IX Header "SUPPORT" .SS "Websites" .IX Subsection "Websites" The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp The default \s-1CPAN\s0 search engine, useful to view \s-1POD\s0 in \s-1HTML\s0 format. .Sp .IP "\(bu" 4 AnnoCPAN .Sp The AnnoCPAN is a website that allows community annotations of Perl module documentation. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp The \s-1CPAN\s0 Ratings is a website that allows community ratings and reviews of Perl modules. .Sp .IP "\(bu" 4 \&\s-1CPANTS\s0 .Sp The \s-1CPANTS\s0 is a website that analyzes the Kwalitee ( code metrics ) of a distribution. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers .Sp The \s-1CPAN\s0 Testers is a network of smokers who run automated tests on uploaded \s-1CPAN\s0 distributions. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers Matrix .Sp The \s-1CPAN\s0 Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Testers Dependencies .Sp The \s-1CPAN\s0 Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. .Sp .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests by email to \f(CW\*(C`ddumont at cpan.org\*(C'\fR, or through the web interface at . You will be automatically notified of any progress on the request by the system. .SS "Source Code" .IX Subsection "Source Code" The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) .PP .PP .Vb 1 \& git clone git://github.com/dod38fr/config\-model\-tester.git .Ve