diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-05-23 12:50:02 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-05-23 12:50:02 +0000 |
commit | 42c51cfe708ef920bbc0912790e32114f879a69f (patch) | |
tree | bbc0de79461b0efdfb9fb3d02e8fa554123387a9 | |
parent | 684ca3bf29e36602ebe5368176498fd25a1d9087 (diff) | |
download | spec-helper-42c51cfe708ef920bbc0912790e32114f879a69f.tar spec-helper-42c51cfe708ef920bbc0912790e32114f879a69f.tar.gz spec-helper-42c51cfe708ef920bbc0912790e32114f879a69f.tar.bz2 spec-helper-42c51cfe708ef920bbc0912790e32114f879a69f.tar.xz spec-helper-42c51cfe708ef920bbc0912790e32114f879a69f.zip |
initial import
-rwxr-xr-x | test.pl | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -0,0 +1,54 @@ +#!/usr/bin/perl +# $Id: gprintify 257533 2009-05-23 12:45:15Z guillomovitch $ + +use strict; +use warnings; + +use IPC::Run qw/run/; +use Test::More tests => 48; +use FindBin; +use File::Temp qw/tempdir/; + +my $path = "$FindBin::Bin/"; + +my ($out, $err); +delete $ENV{RPM_BUILD_ROOT}; + +foreach my $prog qw/ + clean_files + compress_files + relink_symlinks + gprintify + translate_menu + remove_info_dir + fix_pamd + fix_eol + / { + + ($out, $err) = run_prog($prog); + is( $out, '', "$prog stdin without buildroot" ); + like($err, qr/^No build root defined/, "$prog stderr without buildroot"); + + $ENV{RPM_BUILD_ROOT} = "foo"; + + ($out, $err) = run_prog($prog); + is( $out, '', "$prog stdin with wrong buildroot" ); + like($err, qr/^Invalid build root/, "$prog stderr with wrong buildroot"); + + my $buildroot = tempdir(CLEANUP => 1); + + $ENV{RPM_BUILD_ROOT} = $buildroot; + + ($out, $err) = run_prog($prog); + is($out, '', "$prog stdin with correct buildroot" ); + is($err, '', "$prog stderr with correct buildroot"); + + delete $ENV{RPM_BUILD_ROOT}; +} + +sub run_prog { + my ($prog, @args) = @_; + + run (["$FindBin::Bin/$prog", @args], \my($in, $out, $err)); + return ($out, $err); +} |