diff options
author | Luke Kanies <luke@madstop.com> | 2008-01-18 08:56:45 -0800 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-01-18 08:56:45 -0800 |
commit | 7ee4746e2228219c03e5117d24860a623031de14 (patch) | |
tree | 2b62ccdfdf5157d3455f29d85ebeab9642dda085 /ext | |
parent | 34f5bda4e5f40b1137bd49e9d659dded7d473410 (diff) | |
download | puppet-7ee4746e2228219c03e5117d24860a623031de14.tar.gz puppet-7ee4746e2228219c03e5117d24860a623031de14.tar.xz puppet-7ee4746e2228219c03e5117d24860a623031de14.zip |
Adding a parse test to puppet-test.
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/puppet-test | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/ext/puppet-test b/ext/puppet-test index 362a43996..0f33e0cbb 100755 --- a/ext/puppet-test +++ b/ext/puppet-test @@ -53,6 +53,9 @@ # list:: # List all available tests. # +# pause:: +# Pause before starting test (useful for testing with dtrace). +# # repeat:: # How many times to perform the test. # @@ -88,7 +91,7 @@ # Do an initial trap, so that cancels don't get a stack trace. trap(:INT) do $stderr.puts "Cancelling startup" - exit(0) + exit(1) end require 'puppet' @@ -165,6 +168,12 @@ class Suite puts "Running %s %s test" % [@name, test] prepare() + if $options[:pause] + puts "Hit any key to continue" + $stdin.readline + puts "Continuing with test" + end + if $options[:fork] > 0 @forking = true $options[:fork].times { @@ -200,6 +209,17 @@ class Suite end end +Suite.new :parser, "Manifest parsing" do + def prepare + @parser = Puppet::Parser::Parser.new(:environment => Puppet[:environment]) + @parser.file = Puppet[:manifest] + end + + newtest :parse, "Parsed files" do + @parser.parse + end +end + Suite.new :catalog, "Catalog handling" do def prepare $args[:cache] = false @@ -325,12 +345,13 @@ end $cmdargs = [ [ "--compile", "-c", GetoptLong::NO_ARGUMENT ], - [ "--describe", "-D", GetoptLong::REQUIRED_ARGUMENT ], + [ "--describe", GetoptLong::REQUIRED_ARGUMENT ], [ "--retrieve", "-R", GetoptLong::REQUIRED_ARGUMENT ], [ "--fork", GetoptLong::REQUIRED_ARGUMENT ], [ "--fqdn", "-F", GetoptLong::REQUIRED_ARGUMENT ], [ "--suite", "-s", GetoptLong::REQUIRED_ARGUMENT ], [ "--test", "-t", GetoptLong::REQUIRED_ARGUMENT ], + [ "--pause", "-p", GetoptLong::NO_ARGUMENT ], [ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ], [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], [ "--help", "-h", GetoptLong::NO_ARGUMENT ], @@ -340,14 +361,14 @@ $cmdargs = [ ] # Add all of the config parameters as valid $options. -Puppet.config.addargs($cmdargs) +Puppet.settings.addargs($cmdargs) Puppet::Util::Log.newdestination(:console) result = GetoptLong.new(*$cmdargs) $args = {} -$options = {:repeat => 1, :fork => 0} +$options = {:repeat => 1, :fork => 0, :pause => false} begin explicit_waitforcert = false @@ -399,6 +420,8 @@ begin $options[:test] = arg.intern when "--file" $options[:file] = arg + when "--pause" + $options[:pause] = true when "--list" Suite.suites.sort { |a,b| a.to_s <=> b.to_s }.each do |suite_name| suite = Suite[suite_name] @@ -407,7 +430,7 @@ begin end exit(0) else - Puppet.config.handlearg(opt, arg) + Puppet.settings.handlearg(opt, arg) end } rescue GetoptLong::InvalidOption => detail |