From 6a8041abb31a149c32af13b576a1ebf1ec543cb6 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Fri, 1 Jan 2010 22:32:07 +0000 Subject: move basic tests into test subdirectory --- t/run.t | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test.pl | 55 ------------------------------------------------------- 2 files changed, 55 insertions(+), 55 deletions(-) create mode 100755 t/run.t delete mode 100755 test.pl diff --git a/t/run.t b/t/run.t new file mode 100755 index 0000000..8df717a --- /dev/null +++ b/t/run.t @@ -0,0 +1,55 @@ +#!/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 => 54; +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 + strip_and_check_elf_files + / { + + ($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); +} diff --git a/test.pl b/test.pl deleted file mode 100755 index 8df717a..0000000 --- a/test.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/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 => 54; -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 - strip_and_check_elf_files - / { - - ($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); -} -- cgit v1.2.1