Add new twadmin & twprint test-harness tests, to exercise modes, options & errors that aren't covered elsewhere. Update twtools module with additional methods these new tests need.
This commit is contained in:
parent
d8e323e186
commit
a6c796a501
|
@ -0,0 +1,413 @@
|
|||
|
||||
use twtools;
|
||||
|
||||
package twadmin;
|
||||
|
||||
######################################################################
|
||||
# One time module initialization goes in here...
|
||||
#
|
||||
BEGIN {
|
||||
$description = "twadmin test";
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Return the policy file text for this test...
|
||||
#
|
||||
sub getPolicyFileString {
|
||||
|
||||
return <<EOT;
|
||||
|
||||
$twtools::twcwd/$twtools::twrootdir/$TESTS{"twadminInit"}{file} -> +S;
|
||||
|
||||
|
||||
EOT
|
||||
|
||||
}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Initialize, get ready to run this test...
|
||||
#
|
||||
sub initialize() {
|
||||
|
||||
my $twstr = getPolicyFileString();
|
||||
twtools::GeneratePolicyFile($twstr);
|
||||
|
||||
}
|
||||
|
||||
sub runTests() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Run the test.
|
||||
#
|
||||
sub run() {
|
||||
|
||||
my $twpassed = 1;
|
||||
|
||||
|
||||
twtools::logStatus("*** Beginning $description\n");
|
||||
printf("%-30s", "-- $description");
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# print-policy & print-config variants
|
||||
#
|
||||
|
||||
twtools::PrintConfig();
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("base print-cfgfile failed, error = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::PrintConfig(opts => "--verbose");
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("print-cfgfile --verbose failed, error = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::PrintConfig(opts => "--silent");
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("print-cfgfile --silent failed\, error = $?n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::PrintPolicy();
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("base print-polfile failed, error = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::PrintPolicy(opts => "--verbose");
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("print-polfile --verbose failed, error = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::PrintPolicy(opts => "--silent");
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("print-polfile --silent failed, error = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Now try misc help & version options
|
||||
#
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin, no args failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -?`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin -? failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help all`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help all failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help f p`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help d r failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --help asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --asdf --help 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin -m failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m Z 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin -m Z failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m -m 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin -m -m failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Various missing files
|
||||
#
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P nope.txt 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P -c nope.cfg nope.txt 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin -m P -S site.nope nope.txt 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Per-mode help & errors
|
||||
#
|
||||
|
||||
# create-polfile
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --help --create-polfile --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-polfile --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-polfile --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# create-cfgfile
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-cfgfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-cfgfile --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --create-cfgfile --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --create-cfgfile --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# print-polfile
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-polfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-polfile --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-polfile --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-polfile --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# print-cfgfile
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-cfgfile --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-cfgfile --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --print-cfgfile --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --print-cfgfile --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# encrypt
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --encrypt --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --encrypt --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --encrypt --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --encrypt --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# remove-encryption
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --remove-encryption --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --remove-encryption --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --remove-encryption --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --remove-encryption --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# examine
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --examine --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --examine --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --examine --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --examine --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
# generate-keys
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --generate-keys --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --generate-keys --verbose --silent failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --generate-keys--asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --generate-keys--asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
# change-passphrases
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --change-passphrases --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --verbose --silent 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --change-passphrases --verbose --silent` failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --change-passphrases --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twadmin --change-passphrases --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Version
|
||||
#
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twadmin --version`);
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("twadmin --version failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# See if the tests all succeeded...
|
||||
#
|
||||
if ($twpassed) {
|
||||
++$twtools::twpassedtests;
|
||||
print "PASSED\n";
|
||||
}
|
||||
else {
|
||||
++$twtools::twfailedtests;
|
||||
print "*FAILED*\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# One time module cleanup goes in here...
|
||||
#
|
||||
END {
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,282 @@
|
|||
|
||||
use twtools;
|
||||
|
||||
package twprint;
|
||||
|
||||
######################################################################
|
||||
# One time module initialization goes in here...
|
||||
#
|
||||
BEGIN {
|
||||
|
||||
%TESTS = (
|
||||
|
||||
"twprintInit" => {
|
||||
|
||||
changeFunc => \&twtools::MakeBigger,
|
||||
createFunc => \&twtools::CreateFile,
|
||||
file => "printme.txt",
|
||||
perms => "a+w",
|
||||
contents => "testing",
|
||||
violations => "V:1 S:0 A:0 R:0 C:1"
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
$description = "twprint test";
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Return the policy file text for this test...
|
||||
#
|
||||
sub getPolicyFileString {
|
||||
|
||||
return <<EOT;
|
||||
|
||||
$twtools::twcwd/$twtools::twrootdir/$TESTS{"twprintInit"}{file} -> +S;
|
||||
|
||||
|
||||
EOT
|
||||
|
||||
}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Initialize, get ready to run this test...
|
||||
#
|
||||
sub initialize() {
|
||||
|
||||
my $twstr = getPolicyFileString();
|
||||
twtools::GeneratePolicyFile($twstr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Run the test.
|
||||
#
|
||||
sub run() {
|
||||
|
||||
my $twpassed = 1;
|
||||
|
||||
twtools::logStatus("*** Beginning $description\n");
|
||||
printf("%-30s", "-- $description");
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Run a check first, to set up for twprint exercises
|
||||
#
|
||||
$twpassed = twtools::RunIntegrityTests(%TESTS);
|
||||
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Now run thru the valid report levels & verify return codes
|
||||
# TODO: look for expected result in various report levels
|
||||
|
||||
twtools::RunReport({ report-level => 0 });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 0 report failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => 1 });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 1 report failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => 2 });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 2 report failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => 3 });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 3 report failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => 4 });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 4 report failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => "4 --verbose --hexadecimal" });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 4 report (verbose, hex) failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => "4 --silent" });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("level 4 report (silent) failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Now some failure cases, to verify they fail
|
||||
#
|
||||
twtools::RunReport({ report-level => 5 });
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("nonexistent level 5 report failed, result = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => "asdf" });
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("nonexistent level 'asdf' report failed, result = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => "0 --help" });
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("print-report help mode failed, result = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunReport({ report-level => "4 --verbose --silent" });
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("print-report verbose vs silent failed, result = $?\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Now try db printing
|
||||
#
|
||||
twtools::RunDbPrint();
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("db print failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunDbPrint({ db-object-list => "$twtools::twrootdir/printme.txt" });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("db print failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::RunDbPrint({ db-object-list => "$twtools::twrootdir/nonexistent.vbs" });
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("db print failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# Now try misc help & version options
|
||||
#
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint, no args failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint -?`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint -? failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --help all`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help all failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --help d r`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help d r failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --help asdf 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --asdf --help 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help --asdf failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --print-dbfile --help`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help --print-dbfile failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --print-report --help `);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint --help --print-reportfile failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint -m Z 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint -m Z failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint -m 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint -m failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint -m -m 2>&1`);
|
||||
if ( $? != 256 ) {
|
||||
twtools::logStatus("twprint -m -m failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
twtools::logStatus(`$twtools::twrootdir/bin/twprint --version`);
|
||||
if ( $? != 0 ) {
|
||||
twtools::logStatus("twprint --version failed\n");
|
||||
$twpassed = 0;
|
||||
}
|
||||
|
||||
|
||||
#########################################################
|
||||
#
|
||||
# See if the tests all succeeded...
|
||||
#
|
||||
if ($twpassed) {
|
||||
++$twtools::twpassedtests;
|
||||
print "PASSED\n";
|
||||
}
|
||||
else {
|
||||
++$twtools::twfailedtests;
|
||||
print "*FAILED*\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# One time module cleanup goes in here...
|
||||
#
|
||||
END {
|
||||
}
|
||||
|
||||
1;
|
|
@ -210,6 +210,43 @@ sub RemoveEncryption {
|
|||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Print polfile
|
||||
#
|
||||
|
||||
sub PrintPolicy {
|
||||
|
||||
my (%params) = %{$_[0]};
|
||||
logStatus "printing policy file...\n";
|
||||
|
||||
my (@out) = `$twrootdir/bin/twadmin -m p -c $twrootdir/$twcfgloc -p $twrootdir/$twpolfileloc -S $twrootdir/$twsitekeyloc $params{opts} 2>&1`;
|
||||
|
||||
my ($result) = ${^CHILD_ERROR_NATIVE};
|
||||
|
||||
logStatus(@out);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Print polfile
|
||||
#
|
||||
|
||||
sub PrintConfig {
|
||||
|
||||
my (%params) = %{$_[0]};
|
||||
|
||||
logStatus "printing config file...\n";
|
||||
my (@out) = `$twrootdir/bin/twadmin -m f -c $twrootdir/$twcfgloc $params{opts} 2>&1`;
|
||||
|
||||
my ($result) = ${^CHILD_ERROR_NATIVE};
|
||||
|
||||
logStatus(@out);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Write policy text to disk... Note the contents
|
||||
# of the policy file are passed in as '$twstr'.
|
||||
|
@ -286,21 +323,39 @@ sub UpdatePolicy {
|
|||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Use twprint to get a report of specified level (default 0) and return
|
||||
# that.
|
||||
#
|
||||
sub RunReport {
|
||||
|
||||
my (%params) = %{$_[0]};
|
||||
|
||||
$params{report} = $reportloc if( ! defined($params{report}) );
|
||||
$params{report-level} = 0 if( ! defined($params{report-level}) );
|
||||
#$params{report-object-list} = "" if( ! defined($params{report-object-list}) );
|
||||
|
||||
my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t $params{report-level} -r $params{report} 2>&1`;
|
||||
logStatus(@out);
|
||||
|
||||
return @out;
|
||||
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Use twprint to get a report level 0 report and return
|
||||
# that.
|
||||
#
|
||||
sub RunReport(%) {
|
||||
sub RunDbPrint {
|
||||
|
||||
my (%params) = %{$_[0]};
|
||||
$params{report} = $reportloc if( ! defined($params{report}) );
|
||||
my (%params) = %{$_[0]};
|
||||
$params{db-object-list} = "" if( ! defined($params{db-object-list}) );
|
||||
|
||||
my (@out) = `$twrootdir/bin/twprint -m r -c $twrootdir/$twcfgloc -t 0 -r $params{report}`;
|
||||
my (@out) = `$twrootdir/bin/twprint -m d -c $twrootdir/$twcfgloc $params{db-object-list} 2>&1`;
|
||||
|
||||
logStatus(@out);
|
||||
|
||||
return @out;
|
||||
logStatus(@out);
|
||||
|
||||
return @out;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue