# Copyright (c) 2009 Martin Becker. All rights reserved. # This package is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # $Id: 93_examples.t 36 2009-06-08 11:51:03Z demetri $ # Checking whether all scripts in the examples directory run fine. # These are tests for the distribution maintainer, mostly. # Example scripts are intended rather to be simple than bullet-proof. # However, if you do run into problems with them, other than perhaps # some unmet dependencies, feel free to let me know. # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl t/93_examples.t' use 5.006; use strict; use warnings; use Test; use File::Spec; use lib "t/lib"; use Test::MyUtils; use Math::Polynomial 1.000; maintainer_only('d_fork'); plan tests => 10; my $examples_dir = 'examples'; my $shebang_pat = qr{^#!/usr/bin/perl\s}; my $this_perl = Test::MyUtils::this_perl(); my $stdin_file = File::Spec->devnull; my $stdout_file = 't/example.out'; my $stderr_file = 't/example.err'; my $timeout_secs = 10; my $files_count = 0; my @not_executable = (); my @not_readable = (); my @bogus_shebang = (); my @trouble_executing = (); my @bad_exit_code = (); my @stdout_empty = (); my @stderr_nonempty = (); my @timed_out = (); ok(-x $this_perl, 1, 'perl binary is executable'); foreach my $script_path (glob File::Spec->catfile($examples_dir, '*.pl')) { ++$files_count; print "# checking script file $script_path...\n"; if (!-x $script_path) { push @not_executable, $script_path; } if (open SCRIPT, '<', $script_path) { my $first_line =