--- solenv/bin/build.pl	2007-09-05 14:43:32.000000000 +0200
+++ solenv/bin/build.pl	2007-09-06 17:27:42.000000000 +0200
@@ -194,6 +194,9 @@
                             # the server considered as an error/client crash 
     my %lost_client_jobs = (); # hash containing lost jobs
     my %job_jobdir = (); # hash containing job-dir pairs
+
+    $unit_tests = 0;  # use tests.lst in addition to build.lst & build with 'dmake check' there - for unit testing
+    %unit_tests_dirs; # directories that should be built with 'dmake check'
     
 ### main ###
 
@@ -494,18 +497,22 @@ sub dmake_dir {
         return if ($cmd_file || $show);
         chdir $BuildDir;
         getcwd();
+        my $dmake_check = "";
+        if ($unit_tests && exists $unit_tests_dirs{$BuildDir} && $unit_tests_dirs{$BuildDir}) {
+            $dmake_check = "check";
+        }
         if ($html) {
             my $log_file = $jobs_hash{$BuildDir}->{LONG_LOG_PATH};
             my $log_dir = File::Basename::dirname($log_file);
             if (!-d $log_dir) {
                  system("$perl $mkout");
             };
-            $error_code = system ("$dmake > $log_file 2>&1");
+            $error_code = system ("$dmake $dmake_check > $log_file 2>&1");
             if (!$grab_output && -f $log_file) {
                 system("cat $log_file");
             };
         } else {
-            $error_code = system ("$dmake");
+            $error_code = system ("$dmake $dmake_check");
         };
         html_store_dmake_dir_info(\%LocalDepsHash, $BuildDir, $error_code) if (!$child);
     };
@@ -545,8 +552,27 @@ sub store_build_list_content {
     } else {
         if (open (BUILD_LST, $build_list_path)) {
             my @build_lst = <BUILD_LST>;
-            $build_lists_hash{$module} = \@build_lst;
             close BUILD_LST;
+
+            # add the content of tests.lst to @build_lst if we are issued
+            # with 'check'
+            if ($unit_tests) {
+                (my $tests_path = $build_list_path ) =~ s/build\.lst$/tests.lst/;
+                if ($tests_path ne $build_list_path && open (TESTS_LST, $tests_path)) {
+                    while (<TESTS_LST>) {
+                        s/#.*//;
+                        next if (!/\snmake\s/);
+
+                        push @build_lst, $_;
+                        if (/^\s*\S+\s+(\S+)/ ) {
+                            $unit_tests_dirs{CorrectPath($StandDir . $1)} = 1;
+                        }
+                    }
+                    close TESTS_LST;
+                }
+            }
+
+            $build_lists_hash{$module} = \@build_lst;
             return;
         }
         $dead_parents{$module}++;
@@ -1236,6 +1262,7 @@ sub get_options {
             push (@dmake_args, get_job_args()) if (!$custom_job);
             next;
         };
+        $arg =~ /^check$/       and $unit_tests = 1 and next; # it's a dmake target, but we strip it here to add it later
         push (@dmake_args, $arg);
     };
     if (!$html) {
@@ -1290,6 +1317,10 @@ sub get_job_args {
     my @job_args = (); 
     while ($arg = shift @ARGV) {
         next if ($arg =~ /^--$/);
+        if ($arg =~ /^check$/) {
+            $unit_tests = 1;
+            next; # it's a dmake target, but we strip it here to add it later
+        }
         push (@job_args, $arg);
     };
     return @job_args;
--- solenv/inc/target.mk	18 Jul 2007 08:01:14 -0000	1.201
+++ solenv/inc/target.mk	6 Sep 2007 20:44:31 -0000
@@ -2076,3 +2076,9 @@ $(SUBDIRS) .PHONY :
 # as an escaped "#". if it was an assignment, escaping works...
 some_unique_variable_name:=1
 
+# ---------
+# - CHECK -
+# ---------
+# can be redefined in the makefiles to issue the real tests
+
+check: ALLTAR
