aboutsummaryrefslogtreecommitdiffstats
path: root/t/Utils.pm
diff options
context:
space:
mode:
Diffstat (limited to 't/Utils.pm')
-rw-r--r--t/Utils.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/Utils.pm b/t/Utils.pm
new file mode 100644
index 0000000..eef8187
--- /dev/null
+++ b/t/Utils.pm
@@ -0,0 +1,30 @@
+package Utils;
+
+use strict;
+use warnings;
+use base qw(Exporter);
+use FindBin qw/$Bin/;
+use Digest::MD5;
+
+our @EXPORT_OK = qw(run get_md5);
+
+
+sub run {
+ my ($buildroot, $program) = @_;
+
+ $ENV{RPM_BUILD_ROOT} = $buildroot;
+ system("$Bin/../$program");
+}
+
+
+sub get_md5 {
+ my ($file) = @_;
+ open(my $in, '<', $file) or die "can't read $file: $!";
+ binmode($in);
+ my $md5 = Digest::MD5->new();
+ $md5->addfile($in);
+ close($in);
+ return $md5->hexdigest();
+}
+
+1;