[Bps-public-commit] r11376 - SVN-PropDB/bin
clkao at bestpractical.com
clkao at bestpractical.com
Tue Apr 1 23:44:09 EDT 2008
Author: clkao
Date: Tue Apr 1 23:44:09 2008
New Revision: 11376
Added:
SVN-PropDB/bin/taste_recipe
Log:
automatically reduce generated tests.
Added: SVN-PropDB/bin/taste_recipe
==============================================================================
--- (empty file)
+++ SVN-PropDB/bin/taste_recipe Tue Apr 1 23:44:09 2008
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+use strict;
+
+my $script = 'bin/run_test_yml.pl';
+my $file = shift;
+use YAML::Syck;
+
+my $d = YAML::Syck::LoadFile( $file );
+
+use Storable 'dclone';
+use Data::Dumper;
+use File::Temp;
+
+for (reverse 0..$#{ $d->{recipe}} ) {
+ warn "==> removing $_ ".Dumper($d->{recipe}->[$_]);
+ next if $d->[1] eq 'create_record';
+
+ my $foo = dclone $d;
+
+ splice(@{$foo->{recipe}}, $_, 1);
+
+ my $tmpf = File::Temp->new;
+ YAML::Syck::DumpFile($tmpf, $foo);
+ system('perl', '-Ilib', $script, $tmpf);
+ if ($?) {
+ $d = $foo;
+ }
+ warn "result : $?";
+
+}
+
+warn "streamlined recipe at $file.new";
+
+YAML::Syck::DumpFile( "$file.new", $d);
+
+
More information about the Bps-public-commit
mailing list