File tree Expand file tree Collapse file tree 4 files changed +83
-3
lines changed Expand file tree Collapse file tree 4 files changed +83
-3
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env perl
2
+ #
3
+ # Copyright IBM Corp. 2020
4
+ #
5
+ # Usage: checkdeps <perl-file1> [<perl-file2> ...]
6
+ #
7
+ # Check if all Perl modules required by the Perl programs specified on the
8
+ # command line are available. Note that this is a simple check that will only
9
+ # catch straight-forward use directives.
10
+ #
11
+ # Example:
12
+ # $ checkdeps file.pl file2.pl
13
+ #
14
+
15
+ use strict;
16
+ use warnings;
17
+
18
+ my $verbose = 0;
19
+
20
+ sub check_file ($)
21
+ {
22
+ my ($file ) = @_ ;
23
+ my $fd ;
24
+ my $line ;
25
+ my $rc = 0;
26
+
27
+ open ($fd , " <" , $file ) or die (" Could not open $file : $! \n " );
28
+ $line = <$fd >;
29
+
30
+ if ($line =~ / ^#.*perl/ ) {
31
+ while ($line = <$fd >) {
32
+ my $module ;
33
+
34
+ # Look for ...use...module...;
35
+ next if ($line !~ / ^\s *use\s +(\S +).*;\s *$ / );
36
+
37
+ $module = $1 ;
38
+ print (" Checking for $module \n " ) if ($verbose );
39
+ if (!eval (" require $module " )) {
40
+ warn (" Error: Missing Perl module '$module ' " .
41
+ " required by $file \n " );
42
+ $rc = 1;
43
+ }
44
+ }
45
+ }
46
+
47
+ close ($fd );
48
+
49
+ return $rc ;
50
+ }
51
+
52
+ sub main ()
53
+ {
54
+ my $rc = 0;
55
+
56
+ for my $file (@ARGV ) {
57
+ $rc = 1 if (check_file($file ));
58
+ }
59
+
60
+ return $rc ;
61
+ }
62
+
63
+ exit (main());
Original file line number Diff line number Diff line change @@ -15,17 +15,19 @@ if [[ -z "${_TESTS_RUNNING}" ]] ; then
15
15
16
16
testsuite_init
17
17
trap testsuite_exit exit
18
+ # Suppress test results on keyboard interrupt
19
+ trap " trap exit ; exit 1" SIGINT
18
20
fi
19
21
20
22
for TEST in ${TESTS} ; do
21
23
if [[ -d " ${TEST} " ]] ; then
22
24
# Enter sub-directory
23
- ${MAKE} -C " ${TEST} " check
25
+ ${MAKE} -C " ${TEST} " check || exit 1
24
26
else
25
27
# Enter test
26
28
ABS_TEST=" $PWD /$TEST "
27
29
REL_TEST=" ${ABS_TEST## $TOPDIR } "
28
- test_run " ${REL_TEST} " " ${ABS_TEST} " < /dev/null
30
+ test_run " ${REL_TEST} " " ${ABS_TEST} " < /dev/null || exit 1
29
31
fi
30
32
done
31
33
Original file line number Diff line number Diff line change 8
8
# test log file. Must be run after testsuite_init.
9
9
#
10
10
11
+ trap ' echo ; exit 1' SIGINT
12
+
11
13
TOPDIR=$( realpath $( dirname $0 ) /..) && source " $TOPDIR /bin/common"
12
14
EXCERPTLEN=10
13
15
TESTNAME=" $1 "
Original file line number Diff line number Diff line change @@ -43,15 +43,28 @@ endif
43
43
# make TESTS=subdir
44
44
MAKEOVERRIDES := $(filter-out TESTS=% ,$(MAKEOVERRIDES ) )
45
45
46
- check : prepare
46
+ # Default target
47
+ check :
47
48
runtests " $( MAKE) " $(TESTS )
48
49
50
+ ifeq ($(_ONCE ) ,)
51
+
52
+ # Do these only once during initialization
53
+ export _ONCE := 1
54
+
55
+ check : checkdeps prepare
56
+
57
+ checkdeps :
58
+ checkdeps $(TOPDIR ) /../bin/* $(TOPDIR ) /bin/*
59
+
49
60
prepare : $(INFOFILES ) $(COUNTFILES )
50
61
51
62
# Create artificial info files as test data
52
63
$(INFOFILES ) $(COUNTFILES ) :
53
64
cd $(TOPDIR ) && mkinfo profiles/$(SIZE ) -o src/
54
65
66
+ endif
67
+
55
68
clean : clean_echo clean_subdirs
56
69
57
70
clean_echo :
You can’t perform that action at this time.
0 commit comments