From d7d29865f5a892348d8b8580c6fb825e4411cc79 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 29 Sep 2013 15:58:41 +0200 Subject: factorize possible transaction sets definition (needed for next commit) --- t/superuser--split-transactions.t | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 't') diff --git a/t/superuser--split-transactions.t b/t/superuser--split-transactions.t index 75fdd517..6ca5e5f2 100644 --- a/t/superuser--split-transactions.t +++ b/t/superuser--split-transactions.t @@ -14,27 +14,15 @@ need_root_and_prepare(); my $name = 'split-transactions'; urpmi_addmedia("$name $::pwd/media/$name"); -test_urpmi("--auto --split-length 1 c d", <<'EOF', <<'EOF'); -Preparing... - 1/4: a - 2/4: b -Preparing... - 3/4: c -Preparing... - 4/4: d -EOF -Preparing... - 1/4: b - 2/4: a -Preparing... - 3/4: c -Preparing... - 4/4: d -EOF +test_urpmi("--auto --split-length 1 c d", + acceptable_trans_orders(4, + [ [ qw(a b) ], ['c'], ['d'] ], + [ [ qw(b a) ], ['c'], ['d'] ], + )); check_installed_names('a', 'b', 'c', 'd'); sub test_urpmi { - my ($para, $wanted_a, $wanted_b) = @_; + my ($para, @wanted) = @_; my $s = run_urpm_cmd("urpmi $para"); print $s; @@ -43,5 +31,16 @@ sub test_urpmi { $s =~ s/^SECURITY.*//gm; $s =~ s/^\n//gm; - ok(member($s, $wanted_a, $wanted_b), "$wanted_a in $s"); + ok(member($s, @wanted), "$wanted[0] in $s"); +} + +sub acceptable_trans_orders { + my ($total, @solutions) = @_; + my @res; + foreach (@solutions) { + my $count = 0; + push @res, join("\n", map { + ("Preparing...", map { $count++; " $count/$total: $_" } @$_) } @$_) . "\n"; + } + @res; } -- cgit v1.2.1