tests: fix paths for new build path, add "test.sh" wrapper for usability

All tests pass at the moment.
This commit is contained in:
Jakob Unterwurzacher 2015-11-12 19:08:52 +01:00
parent c3e63d7836
commit a424a2155b
5 changed files with 18 additions and 9 deletions

10
test.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -eux
if [ ! -d build ]
then
./build.sh
fi
perl -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' tests/*.t.pl

View File

@ -12,7 +12,7 @@ sub mount_encfs_reverse {
my $c = shift;
my $opts = shift;
my $cmdline = "./encfs/encfs --extpass=\"echo test\" --standard $p $c --reverse $opts 2>&1 > /dev/null";
my $cmdline = "./build/encfs --extpass=\"echo test\" --standard $p $c --reverse $opts 2>&1 > /dev/null";
# print "mounting encfs: $cmdline\n";
my $status = system($cmdline);
if ( $status != 0 ) { die("command returned error: $status"); }

View File

@ -35,7 +35,7 @@ sub mount_encfs {
mkdir($p);
delete $ENV{"ENCFS6_CONFIG"};
system("./encfs/encfs --extpass=\"echo test\" --standard $c $p > /dev/null");
system("./build/encfs --extpass=\"echo test\" --standard $c $p > /dev/null");
waitForFile("$c/.encfs6.xml") or die("Control file not created");
print "# encfs mounted on $p\n";
@ -156,7 +156,6 @@ sub main {
if ( $> != 0 ) {
print("This test must be run as root!\n");
exit(2);
}
dl_linuxgz();

View File

@ -2,7 +2,7 @@
# Test EncFS normal and paranoid mode
use Test::More tests => 103;
use Test::More tests => 102;
use File::Path;
use File::Copy;
use File::Temp;
@ -261,7 +261,7 @@ sub checkContents
sub encName
{
my $plain = shift;
my $enc = qx(./encfs/encfsctl encode --extpass="echo test" $raw $plain);
my $enc = qx(./build/encfsctl encode --extpass="echo test" $raw $plain);
chomp($enc);
return $enc;
}
@ -304,7 +304,7 @@ sub mount
mkdir($crypt) || BAIL_OUT("Could not create $crypt: $!");
delete $ENV{"ENCFS6_CONFIG"};
my $cmdline = "./encfs/encfs --extpass=\"echo test\" $args $raw $crypt 2>&1";
my $cmdline = "./build/encfs --extpass=\"echo test\" $args $raw $crypt 2>&1";
# This makes sure we get to see stderr ^
my $status = system($cmdline);
ok( $status == 0, "encfs command returns 0") || BAIL_OUT("");

View File

@ -46,11 +46,11 @@ sub cleanup
sub mount
{
delete $ENV{"ENCFS6_CONFIG"};
system("./encfs/encfs --extpass=\"echo test\" --standard $plain $ciphertext --reverse --nocache");
system("./build/encfs --extpass=\"echo test\" --standard $plain $ciphertext --reverse --nocache");
ok(waitForFile("$plain/.encfs6.xml"), "plain .encfs6.xml exists") or BAIL_OUT("'$plain/.encfs6.xml'");
my $e = encName(".encfs6.xml");
ok(waitForFile("$ciphertext/$e"), "encrypted .encfs6.xml exists") or BAIL_OUT("'$ciphertext/$e'");
system("ENCFS6_CONFIG=$plain/.encfs6.xml ./encfs/encfs --nocache --extpass=\"echo test\" $ciphertext $decrypted");
system("ENCFS6_CONFIG=$plain/.encfs6.xml ./build/encfs --nocache --extpass=\"echo test\" $ciphertext $decrypted");
ok(waitForFile("$decrypted/.encfs6.xml"), "decrypted .encfs6.xml exists") or BAIL_OUT("'$decrypted/.encfs6.xml'");
}
@ -60,7 +60,7 @@ sub mount
sub encName
{
my $name = shift;
my $enc = qx(ENCFS6_CONFIG=$plain/.encfs6.xml ./encfs/encfsctl encode --extpass="echo test" $ciphertext $name);
my $enc = qx(ENCFS6_CONFIG=$plain/.encfs6.xml ./build/encfsctl encode --extpass="echo test" $ciphertext $name);
chomp($enc);
return $enc;
}