diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-06-29 22:00:26 +0300 |
---|---|---|
committer | Modestas Vainius <modestas@vainius.eu> | 2009-06-30 00:53:07 +0300 |
commit | a6ed7fc6ac9d45733c03e935d1a6e5ec08871944 (patch) | |
tree | f92ee075cd0b9fc1115d7f4b9a62e098d0c1b6bc /t | |
parent | 961d75b2c35d7afcf6f7954604f9442db31eec90 (diff) | |
download | debhelper-a6ed7fc6ac9d45733c03e935d1a6e5ec08871944.tar.gz |
Support absolute paths for builddir.
If build directory is absolute or ../ path, _rel2rel falls back to
absolute paths. Try even harder to convert supplied builddir to
relative in _set_builddir().
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 't')
-rwxr-xr-x | t/buildsystems/buildsystem_tests | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/t/buildsystems/buildsystem_tests b/t/buildsystems/buildsystem_tests index e54663c8..c432d3ec 100755 --- a/t/buildsystems/buildsystem_tests +++ b/t/buildsystems/buildsystem_tests @@ -1,6 +1,6 @@ #!/usr/bin/perl -use Test::More tests => 228; +use Test::More tests => 230; use strict; use warnings; @@ -66,14 +66,18 @@ is( $BS_CLASS->canonpath("path/to/../../../somewhere"), is( $BS_CLASS->canonpath("./"), ".", "canonpath no4" ); is( $BS_CLASS->canonpath("/absolute/path/./somewhere/../to/nowhere"), "/absolute/path/to/nowhere", "canonpath no5" ); -is( $BS_CLASS->_rel2rel("path/my/file", "path/my"), +is( $BS_CLASS->_rel2rel("path/my/file", "path/my", "/tmp"), "file", "_rel2rel no1" ); -is( $BS_CLASS->_rel2rel("path/dir/file", "path/my"), +is( $BS_CLASS->_rel2rel("path/dir/file", "path/my", "/tmp"), "../dir/file", "_rel2rel no2" ); is( $BS_CLASS->_rel2rel("file", "/root/path/my", "/root"), - "../../file", "_rel2rel no3" ); -is( $BS_CLASS->_rel2rel(".", "."), ".", "_rel2rel no4" ); -is( $BS_CLASS->_rel2rel("path", "path/"), ".", "_rel2rel no5" ); + "/root/file", "_rel2rel abs no3" ); +is( $BS_CLASS->_rel2rel(".", ".", "/tmp"), ".", "_rel2rel no4" ); +is( $BS_CLASS->_rel2rel("path", "path/", "/tmp"), ".", "_rel2rel no5" ); +is( $BS_CLASS->_rel2rel("/absolute/path", "anybase", "/tmp"), + "/absolute/path", "_rel2rel abs no6"); +is( $BS_CLASS->_rel2rel("relative/path", "/absolute/base", "/tmp"), + "/tmp/relative/path", "_rel2rel abs no7"); ### Test Buildsystem class path API methods under different configurations sub test_buildsystem_paths_api { @@ -355,17 +359,18 @@ if (defined \$bs) { EOF } +$tmp = Cwd::getcwd(); is_deeply( process_stdout("$^X -- - --builddirectory='autoconf/bld dir' --sourcedirectory autoconf", get_load_bs_source(undef, "configure")), - [ 'NAME=autoconf', 'builddir=autoconf/bld dir', 'makecmd=make', 'sourcedir=autoconf' ], + [ 'NAME=autoconf', 'builddir=autoconf/bld dir', "cwd=$tmp", 'makecmd=make', 'sourcedir=autoconf' ], "autoconf autoselection and sourcedir/builddir" ); is_deeply( process_stdout("$^X -- - -Sautoconf -D autoconf", get_load_bs_source("autoconf", "build")), - [ 'NAME=autoconf', 'builddir=undef', 'makecmd=make', 'sourcedir=autoconf' ], + [ 'NAME=autoconf', 'builddir=undef', "cwd=$tmp", 'makecmd=make', 'sourcedir=autoconf' ], "forced autoconf and sourcedir" ); is_deeply( process_stdout("$^X -- - -B -Sautoconf", get_load_bs_source("autoconf", "build")), - [ 'NAME=autoconf', "builddir=$default_builddir", 'makecmd=make', 'sourcedir=.' ], + [ 'NAME=autoconf', "builddir=$default_builddir", "cwd=$tmp", 'makecmd=make', 'sourcedir=.' ], "forced autoconf and default build directory" ); # Build the autoconf test package |