summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-31 06:35:23 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-31 06:35:23 +0000
commit8ab272265d30ea01322943c688e815ad772a571a (patch)
treeee58690ed366946f7d11a4a2e3031817a9d3cd10
parentf9d89b50139e7688e22525b26cd479f164927788 (diff)
downloadpuppet-8ab272265d30ea01322943c688e815ad772a571a.tar.gz
puppet-8ab272265d30ea01322943c688e815ad772a571a.tar.xz
puppet-8ab272265d30ea01322943c688e815ad772a571a.zip
Hah! Finally fixing the problem where mount tests would fail when run as part of the whole suite. The real problem was that I was changing the filetype of the provider without setting it to change back after the test, but the key change that made it straightforward to fix this problem was that my test loader was not exiting with a non-zero code when there was a failure, which mean that the ./test script never thought anything failed. I fixed the former, then fixed the test script to work fine with -n method_name stuff, and quickly found the problem. *whew*
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2377 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--test/lib/rake/puppet_test_loader.rb4
-rwxr-xr-xtest/ral/types/mount.rb2
-rwxr-xr-xtest/test84
3 files changed, 46 insertions, 44 deletions
diff --git a/test/lib/rake/puppet_test_loader.rb b/test/lib/rake/puppet_test_loader.rb
index a85cc8e6b..23033fa5d 100644
--- a/test/lib/rake/puppet_test_loader.rb
+++ b/test/lib/rake/puppet_test_loader.rb
@@ -10,6 +10,8 @@ args.each { |f| require f unless f =~ /^-/ }
runner = Test::Unit::AutoRunner.new(false)
runner.process_args
-runner.run
+unless runner.run
+ exit 14
+end
# $Id$
diff --git a/test/ral/types/mount.rb b/test/ral/types/mount.rb
index 5987db631..23fee5ac7 100755
--- a/test/ral/types/mount.rb
+++ b/test/ral/types/mount.rb
@@ -229,7 +229,9 @@ class TestMounts < Test::Unit::TestCase
"FSTab %s does not exist" % file)
# Now switch to ram, so we're just doing this there, not really on disk.
+ oldtype = provider.filetype
provider.filetype = :ram
+ cleanup { provider.filetype = oldtype }
#provider.target_object(file).write text
end
diff --git a/test/test b/test/test
index c53b15782..172625b41 100755
--- a/test/test
+++ b/test/test
@@ -9,44 +9,6 @@ require 'find'
require 'getoptlong'
include Find
-result = GetoptLong.new(
- [ "--build", "-b", GetoptLong::NO_ARGUMENT ],
- [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
- [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
- [ "-n", GetoptLong::REQUIRED_ARGUMENT ],
- [ "--files", "-f", GetoptLong::NO_ARGUMENT ],
- [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
-)
-
-usage = "USAGE: %s [--help] suite" % $0
-
-$options = {}
-keep = []
-
-result.each { |opt,arg|
- case opt
- when "--build"
- $options[:build] = true
- when "--verbose"
- $options[:verbose] = true
- when "--files"
- $options[:files] = true
- when "--debug"
- $options[:debug] = true
- when "--help"
- puts usage
- exit
- else
- keep << opt
- keep << arg if arg
- end
-}
-p $options
-
-keep.each do |i|
- ARGV << i
-end
-
def dirs
Dir.glob("*").find_all { |d| FileTest.directory?(d) }.reject { |d|
["lib", "data"].include?(d)
@@ -72,7 +34,7 @@ def resolve(dir)
failed = nil
dirs.each do |d|
next if d == dir
- unless run(d, dir)
+ unless run([d, dir])
failed = d
break
end
@@ -82,7 +44,7 @@ def resolve(dir)
files = ruby_files(failed)
files.each do |file|
- unless run(file, dir)
+ unless run([file, dir])
puts file
exit(0)
end
@@ -102,10 +64,13 @@ def ruby_files(dir)
files
end
-def run(*files)
+def run(files, flags = nil)
args = %w{ruby}
args << "-Ilib:../lib"
args << "lib/rake/puppet_test_loader.rb"
+ if flags
+ args += flags
+ end
args += ARGV
print files.join(" ") + "... "
@@ -139,9 +104,42 @@ def run(*files)
end
end
+result = GetoptLong.new(
+ [ "--build", "-b", GetoptLong::NO_ARGUMENT ],
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
+ [ "-n", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--files", "-f", GetoptLong::NO_ARGUMENT ],
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
+)
+
+usage = "USAGE: %s [--help] suite" % $0
+
+$options = {}
+keep = []
+
+result.each { |opt,arg|
+ case opt
+ when "--build"
+ $options[:build] = true
+ when "--verbose"
+ $options[:verbose] = true
+ when "--files"
+ $options[:files] = true
+ when "--debug"
+ $options[:debug] = true
+ $options[:verbose] = true
+ when "--help"
+ puts usage
+ exit
+ else
+ keep << opt
+ keep << arg if arg
+ end
+}
+
if $options[:files]
- puts "files"
- run(*ARGV)
+ run(ARGV, keep)
else
dir = ARGV.shift