update ooo310-m15
[ooovba.git] / applied_patches / 0658-unittesting-build-pl.diff
blobadc73926147a754fa58b22c2b9bc04d815bdd002
1 diff --git solenv/bin/build.pl solenv/bin/build.pl
2 index d9e862a..d4084b9 100644
3 --- solenv/bin/build.pl
4 +++ solenv/bin/build.pl
5 @@ -196,6 +196,10 @@
6 # the server considered as an error/client crash
7 my %lost_client_jobs = (); # hash containing lost jobs
8 my %job_jobdir = (); # hash containing job-dir pairs
10 + $unit_tests = 0; # use tests.lst in addition to build.lst & build with 'dmake check' there - for unit testing
11 + %unit_tests_dirs; # directories that should be built with 'dmake check'
13 ### main ###
15 get_options();
16 @@ -503,7 +507,11 @@ sub dmake_dir {
18 RemoveFromDependencies($BuildDir, \%LocalDepsHash) if (!$child);
19 return if ($cmd_file || $show);
20 - $error_code = run_job($dmake, $BuildDir);
21 + my $dmake_command = $dmake;
22 + if ($unit_tests && exists $unit_tests_dirs{$BuildDir} && $unit_tests_dirs{$BuildDir}) {
23 + $dmake_command .= " check";
24 + }
25 + $error_code = run_job($dmake_command, $BuildDir);
26 # chdir $BuildDir;
27 # getcwd();
28 # if ($html) {
29 @@ -512,14 +520,14 @@ sub dmake_dir {
30 # if (!-d $log_dir) {
31 # system("$perl $mkout");
32 # };
33 -# $error_code = system ("$dmake > $log_file 2>&1");
34 -# if (!$grab_output && -f $log_file) {
35 +# $error_code = system ("$dmake $dmake_check > $log_file 2>&1");
36 +# if (!$grab_output && -f $log_file) {
37 # system("cat $log_file");
38 # };
39 # } else {
40 -# $error_code = system ("$dmake");
41 +# $error_code = system ("$dmake $dmake_check");
42 # };
45 html_store_job_info(\%LocalDepsHash, $BuildDir, $error_code) if (!$child);
47 if ($error_code && $ignore) {
48 @@ -562,8 +570,27 @@ sub store_build_list_content {
49 } else {
50 if (open (BUILD_LST, $build_list_path)) {
51 my @build_lst = <BUILD_LST>;
52 - $build_lists_hash{$module} = \@build_lst;
53 close BUILD_LST;
55 + # add the content of tests.lst to @build_lst if we are issued
56 + # with 'check'
57 + if ($unit_tests) {
58 + (my $tests_path = $build_list_path ) =~ s/build\.lst$/tests.lst/;
59 + if ($tests_path ne $build_list_path && open (TESTS_LST, $tests_path)) {
60 + while (<TESTS_LST>) {
61 + s/#.*//;
62 + next if (!/\snmake\s/);
64 + push @build_lst, $_;
65 + if (/^\s*\S+\s+(\S+)/ ) {
66 + $unit_tests_dirs{CorrectPath($StandDir . $1)} = 1;
67 + }
68 + }
69 + close TESTS_LST;
70 + }
71 + }
73 + $build_lists_hash{$module} = \@build_lst;
74 return;
76 $dead_parents{$module}++;
77 @@ -1286,6 +1313,7 @@ sub get_options {
78 push (@dmake_args, get_dmake_args()) if (!$custom_job);
79 next;
81 + $arg =~ /^check$/ and $unit_tests = 1 and next; # it's a dmake target, but we strip it here to add it later
82 push (@dmake_args, $arg);
84 if (!$html) {
85 @@ -1347,6 +1375,10 @@ sub get_dmake_args {
86 my @job_args = ();
87 while ($arg = shift @ARGV) {
88 next if ($arg =~ /^--$/);
89 + if ($arg =~ /^check$/) {
90 + $unit_tests = 1;
91 + next; # it's a dmake target, but we strip it here to add it later
92 + }
93 push (@job_args, $arg);
95 return @job_args;
96 diff --git solenv/inc/target.mk solenv/inc/target.mk
97 index afb9580..614c10e 100644
98 --- solenv/inc/target.mk
99 +++ solenv/inc/target.mk
100 @@ -2080,3 +2080,10 @@ $(SUBDIRS) .PHONY :
101 # if the previous block was a rule or a target, "\#" isn't recognized
102 # as an escaped "#". if it was an assignment, escaping works...
103 some_unique_variable_name:=1
105 +# ---------
106 +# - CHECK -
107 +# ---------
108 +# can be redefined in the makefiles to issue the real tests
110 +check: ALLTAR