Changeset 130 for honeyclient/branches/rel/0.9/t
- Timestamp:
- 12/20/06 11:09:07 (2 years ago)
- Files:
-
- honeyclient/branches/rel/0.9 (modified) (1 prop)
- honeyclient/branches/rel/0.9/t/honeyclient_agent.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_agent.t)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_driver.t (modified) (1 diff)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_driver_browser.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_agent_driver_browser.t)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_driver_browser_ie.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_agent_driver_browser_ie.t)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_integrity.t (modified) (3 diffs)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_integrity_registry.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_agent_integrity_registry.t)
- honeyclient/branches/rel/0.9/t/honeyclient_agent_integrity_registry_parser.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_agent_integrity_registry_parser.t)
- honeyclient/branches/rel/0.9/t/honeyclient_manager.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_manager.t)
- honeyclient/branches/rel/0.9/t/honeyclient_manager_fw.t (copied) (copied from honeyclient/tags/bug/POST-42/t/honeyclient_manager_fw.t)
- honeyclient/branches/rel/0.9/t/honeyclient_manager_vm.t (modified) (2 diffs)
- honeyclient/branches/rel/0.9/t/honeyclient_util_config.t (modified) (3 diffs)
- honeyclient/branches/rel/0.9/t/honeyclient_util_soap.t (modified) (1 diff)
- honeyclient/branches/rel/0.9/t/test_registry (copied) (copied from honeyclient/tags/bug/POST-42/t/test_registry)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/rel/0.9
- Property sc:bug-fix-release-branch set to 0.9
honeyclient/branches/rel/0.9/t/honeyclient_agent_driver.t
r13 r130 11 11 # Make sure Log::Log4perl loads 12 12 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted within the path.");13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 14 14 15 15 # Suppress all logging messages, since we need clean output for unit testing. honeyclient/branches/rel/0.9/t/honeyclient_agent_integrity.t
r13 r130 17 17 can_ok('HoneyClient::Agent::Integrity', 'initFileSystem'); 18 18 can_ok('HoneyClient::Agent::Integrity', 'checkFileSystem'); 19 can_ok('HoneyClient::Agent::Integrity', 'initRegistry'); 20 can_ok('HoneyClient::Agent::Integrity', 'checkRegistry'); 21 use HoneyClient::Agent::Integrity qw(initAll checkAll initRegistry checkRegistry initFileSystem checkFileSystem); 19 use HoneyClient::Agent::Integrity qw(initAll checkAll initFileSystem checkFileSystem); 22 20 23 21 # Make sure HoneyClient::Util::Config loads. … … 46 44 47 45 # Make sure Storable loads. 48 BEGIN { use_ok('Storable', qw(dclone )) or diag("Can't load Storable package. Check to make sure the package library is correctly listed within the path."); }46 BEGIN { use_ok('Storable', qw(dclone nfreeze thaw)) or diag("Can't load Storable package. Check to make sure the package library is correctly listed within the path."); } 49 47 require_ok('Storable'); 50 48 can_ok('Storable', 'dclone'); 51 use Storable qw(dclone); 49 can_ok('Storable', 'nfreeze'); 50 can_ok('Storable', 'thaw'); 51 use Storable qw(dclone nfreeze thaw); 52 52 53 53 ###Testing Globals### 54 54 # Directory where the known-good test files are stored 55 $test_dir = getVar(name => "test_dir" , namespace => "HoneyClient::Agent::Integrity");55 $test_dir = getVar(name => "test_dir"); 56 56 57 57 # List of files and directories to check during filesystem checking 58 $file_checklist = getVar(name => "file_checklist" , namespace => "HoneyClient::Agent::Integrity");58 $file_checklist = getVar(name => "file_checklist"); 59 59 60 60 # List of files or directories to exclude if found in subdirs during 61 61 # filesystem check. 62 $file_exclude = getVar(name => "file_exclude" , namespace => "HoneyClient::Agent::Integrity");62 $file_exclude = getVar(name => "file_exclude"); 63 63 64 64 # File where found changes are written to 65 $change_file = getVar(name => "change_file" , namespace => "HoneyClient::Agent::Integrity"),65 $change_file = getVar(name => "change_file"); 66 66 } 67 67 … … 160 160 161 161 162 # =begin testing163 {164 #Testing initRegistry()165 my $ob = HoneyClient::Agent::Integrity->new();166 167 system("regedit.exe /s noTEST.reg");168 system("regedit.exe /s /c $test_dir/t1a.reg");169 $ob->initRegistry("HKEY_LOCAL_MACHINE\\HARDWARE\\TEST");170 open (DIFF, "diff $test_dir/t1a.reg clean.reg0 |") or die "Can't check the changes files\n";171 @result = <DIFF>;172 close DIFF;173 #Bad test because it will be empty in the case of an error anyway?174 is(scalar(@result), 0, 'initRegistry: General Test');175 }176 177 178 179 # =begin testing180 {181 my $ob = HoneyClient::Agent::Integrity->new();182 183 reg_test($ob, 1, "checkRegistry: case 1 Multi-line addition changes.");184 reg_test($ob, 2, "checkRegistry: case 2 Single-line addition changes.");185 reg_test($ob, 3, "checkRegistry: case 3 Multi-line deletion changes.");186 reg_test($ob, 4, "checkRegistry: case 4 Single-line deletion changes.");187 reg_test($ob, 5, "checkRegistry: case 5 Simple multi-line to multi-line changes.");188 is(6, 6, "checkRegistry: case 6 - SKIPPING (currently can't recreate conditions for test)");189 #reg_test($ob, 6, "checkRegistry: case 6 Complicated multi-line to multi-line changes.");190 reg_test($ob, 7, "checkRegistry: case 7 Simple multi-line to single-line changes.");191 reg_test($ob, 8, "checkRegistry: case 8 Complicated multi-line to single-line changes.");192 reg_test($ob, 9, "checkRegistry: case 9 Simple single-line to multi-line changes.");193 reg_test($ob, 10, "checkRegistry: case 10 Complicated single-line to multi-line changes.");194 reg_test($ob, 11, "checkRegistry: case 11 Simple single-line to single-line changes.");195 reg_test($ob, 12, "checkRegistry: case12 Complicated single-line to single-line changes.");196 197 sub reg_test{198 my $ob = shift;199 my $num = shift;200 my $string = shift;201 202 #for safety203 if(-e "temp_reg_export.reg"){204 system("mv temp_reg_export.reg temp_reg_export.reg.CBL");205 }206 system('regedit.exe /a temp_reg_export.reg "HKEY_LOCAL_MACHINE\HARDWARE\TEST"');207 208 system("regedit.exe /s noTEST.reg");209 system("regedit.exe /s /c $test_dir/t" . "$num" . "a.reg");210 $ob->initRegistry("HKEY_LOCAL_MACHINE\\HARDWARE");211 system("regedit.exe /s noTEST.reg");212 system("regedit.exe /s /c $test_dir/t" . "$num" . "b.reg");213 $ob->checkRegistry("HKEY_LOCAL_MACHINE\\HARDWARE");214 open (DIFF, "diff $test_dir/t" . "$num" . "changes.txt changes.txt |") or die "Can't check the changes files\n";215 @result = <DIFF>;216 close DIFF;217 #Bad test because it will be empty in the case of an error anyway?218 is(scalar(@result), 0, "$string");219 220 #for safety/cleanup221 if(-e "temp_reg_export.reg"){222 system("regedit.exe /s noTEST.reg");223 system("regedit.exe /s /c temp_reg_export.reg");224 system("rm temp_reg_export.reg");225 if(-e "temp_reg_export.reg.CBL"){226 system("mv temp_reg_export.reg.CBL temp_reg_export.reg");227 }228 }229 230 }231 }232 233 234 235 162 236 163 1; honeyclient/branches/rel/0.9/t/honeyclient_manager_vm.t
r13 r130 14 14 # Make sure Log::Log4perl loads 15 15 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 16 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted within the path.");16 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 17 17 18 18 # Suppress all logging messages, since we need clean output for unit testing. … … 156 156 # TODO: Remove this once unit testing should actually be used. 157 157 # Ideally, this should be handled programmatically, based upon user prompt. 158 #exit;158 exit; 159 159 160 160 # Generate a notice, to inform the tester that these tests are not honeyclient/branches/rel/0.9/t/honeyclient_util_config.t
r13 r130 11 11 # Make sure Log::Log4perl loads 12 12 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted within the path.");13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 14 14 15 15 # Suppress all logging messages, since we need clean output for unit testing. … … 52 52 # Make sure XML::Tidy loads 53 53 BEGIN { use_ok('XML::Tidy') 54 or diag("Can't load XML::Tidy package. Check to make sure the package library is correctly li nsted within the path."); }54 or diag("Can't load XML::Tidy package. Check to make sure the package library is correctly listed within the path."); } 55 55 require_ok('XML::Tidy'); 56 56 can_ok('XML::Tidy','tidy'); … … 60 60 # Make sure Data::Dumper loads 61 61 BEGIN { use_ok('Data::Dumper') 62 or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly li nsted within the path."); }62 or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); } 63 63 require_ok('Data::Dumper'); 64 64 use Data::Dumper; honeyclient/branches/rel/0.9/t/honeyclient_util_soap.t
r13 r130 11 11 # Make sure Log::Log4perl loads 12 12 BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) 13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly li nsted within the path.");13 or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); 14 14 15 15 # Suppress all logging messages, since we need clean output for unit testing.
