diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-22 05:34:43 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-11-22 05:34:43 +0000 |
commit | 9f942b0369d639abb80254e019dff603d0433588 (patch) | |
tree | bc12df786c4fadcdcb458b48187f01aac84f6b9a | |
parent | 58c0df175ca94cd8bed38cbb76659bfa57e56fe5 (diff) | |
download | puppet-9f942b0369d639abb80254e019dff603d0433588.tar.gz puppet-9f942b0369d639abb80254e019dff603d0433588.tar.xz puppet-9f942b0369d639abb80254e019dff603d0433588.zip |
fixing tests to work from any CWD
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@750 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | test/puppettest.rb | 22 | ||||
-rwxr-xr-x | test/test | 4 |
2 files changed, 18 insertions, 8 deletions
diff --git a/test/puppettest.rb b/test/puppettest.rb index 2d291a91d..be3ec8279 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -706,22 +706,32 @@ end class PuppetTestSuite attr_accessor :subdir + def self.basedir + unless defined? @basedir + @basedir = File.join($puppetbase, "test") + end + @basedir + end + def self.list - Dir.entries(".").find_all { |file| - FileTest.directory?(file) and file !~ /^\./ + puts "testdir is %s" % self.basedir + Dir.entries(self.basedir).find_all { |file| + path = File.join(@basedir, file) + FileTest.directory?(path) and file !~ /^\./ } end def initialize(name) - unless FileTest.directory?(name) + path = File.join(self.class.basedir, name) + unless FileTest.directory?(path) puts "TestSuites are directories containing test cases" - puts "no such directory: %s" % name + puts "no such directory: %s" % path exit(65) end # load each of the files - Dir.entries(name).collect { |file| - File.join(name,file) + Dir.entries(path).collect { |file| + File.join(path,file) }.find_all { |file| FileTest.file?(file) and file =~ /\.rb$/ }.sort { |a,b| @@ -4,11 +4,11 @@ # run any or all test suites basedir = File.dirname(__FILE__) +$puppetbase = File.expand_path(File.join(basedir, "..")) $:.unshift basedir -$:.unshift '#{basedir}/lib' +$:.unshift "#{$puppetbase}/lib" -$puppetbase = ".." require 'puppettest.rb' require 'getoptlong' |