Browse Source

* synchronized with trunk

git-svn-id: branches/wasm@48334 -
nickysn 4 years ago
parent
commit
fe7c14a2c0
2 changed files with 28 additions and 13 deletions
  1. 16 7
      packages/fpmkunit/src/fpmkunit.pp
  2. 12 6
      tests/bench/bcase.pp

+ 16 - 7
packages/fpmkunit/src/fpmkunit.pp

@@ -3383,9 +3383,8 @@ begin
 end;
 
 procedure TCompileWorkerThread.execute;
-begin
-  while not Terminated do
-    begin
+  procedure RaiseMainEvent;
+  begin
     { Make sure all of our results are committed before we set (F)Done to true.
       While RTLeventSetEvent implies a barrier, once the main thread is notified
       it will walk over all threads and look for those that have Done=true -> it
@@ -3394,6 +3393,12 @@ begin
     WriteBarrier;
     FDone:=true;
     RTLeventSetEvent(FNotifyMainThreadEvent);
+  end;
+begin
+  if not Terminated then
+    RaiseMainEvent;
+  while not Terminated do
+    begin
     RTLeventWaitFor(FNotifyStartTask,500);
     if not FDone then
       begin
@@ -3404,9 +3409,15 @@ begin
       try
         FBuildEngine.Compile(APackage);
         FCompilationOK:=true;
+        FBuildEngine.log(vlInfo,'Done compiling: '+APackage.Name);
+        RaiseMainEvent;
       except
         on E: Exception do
-          FErrorMessage := E.Message;
+          begin
+            FErrorMessage := 'Failed compiling: '+APackage.Name+': '+E.Message;
+            FBuildEngine.log(vlInfo,FErrorMessage);
+            RaiseMainEvent;
+          end;
       end;
       end;
     end;
@@ -8621,9 +8632,7 @@ Var
           WriteBarrier;
           AThread.FDone:=False;
           RTLeventSetEvent(AThread.NotifyStartTask);
-          end
-        else
-          sleep(100);
+          end;
         if not PackageAvailable then
           Finished := True;
       end;

+ 12 - 6
tests/bench/bcase.pp

@@ -1375,8 +1375,8 @@ procedure TSingleEntryAtMinus4WithElse.DoTestIteration(Iteration: Integer);
     { This helps catch errors where all branches, including else, are skipped }
     FResultStorage[Byte(Index)] := $FF;
     case Index of
-      -4: FResultStorage[Index] := 1;
-      else FResultStorage[Index] := 0;
+      -4: FResultStorage[Byte(Index)] := 1;
+      else FResultStorage[Byte(Index)] := 0;
     end;
   end;
 
@@ -1609,8 +1609,8 @@ procedure TSingleEntryWithMinus1To5RangeWithElse.DoTestIteration(Iteration: Inte
     { This helps catch errors where all branches, including else, are skipped }
     FResultStorage[Byte(Index)] := $FF;
     case Index of
-      -1..5: FResultStorage[Index] := 1;
-      else FResultStorage[Index] := 0;
+      -1..5: FResultStorage[Byte(Index)] := 1;
+      else FResultStorage[Byte(Index)] := 0;
     end;
   end;
 
@@ -1658,8 +1658,8 @@ procedure TSingleEntryWithMinus1To50RangeWithElse.DoTestIteration(Iteration: Int
     { This helps catch errors where all branches, including else, are skipped }
     FResultStorage[Byte(Index)] := $FF;
     case Index of
-      -1..50: FResultStorage[Index] := 1;
-      else FResultStorage[Index] := 0;
+      -1..50: FResultStorage[Byte(Index)] := 1;
+      else FResultStorage[Byte(Index)] := 0;
     end;
   end;
 
@@ -1739,8 +1739,11 @@ procedure TExtremeRange2.DoTestIteration(Iteration: Integer);
   var
     Index, Input: Word;
   begin
+{$push}
+{$r-}
     Index := (Iteration and $FFFF);
     Input := (Iteration and $1) - 1;
+{$pop}
     FResultStorage[Index] := 0; { Covers $FFFF }
     case Input of
       0..$FFFD:
@@ -1826,8 +1829,11 @@ procedure TExtremeRange4.DoTestIteration(Iteration: Integer);
   var
     Index, Input: Word;
   begin
+{$push}
+{$r-}
     Index := (Iteration and $FFFF);
     Input := (Iteration and $1) - 1;
+{$pop}
     FResultStorage[Index] := 2; { Covers 1..$FFFE }
     case Input of
       0: