diff --git a/tests/utils/macos/LinkRunDir b/tests/utils/macos/LinkRunDir
index 5b17cc5f97..13bd52a1a7 100644
--- a/tests/utils/macos/LinkRunDir
+++ b/tests/utils/macos/LinkRunDir
@@ -1,186 +1 @@
-#Assembles, links and run tests of FreePascal
-#Param 1, the directory with the tests to perform.
-#Note versions can be either 2 or 3 fields, e g 1.1  1.0.10
-
-Export nrOfSucceded
-Export nrOfFailed
-
-#Iterate through tests
-Set Exit 0 # To handle the case, in the for stmt, when there is no match
-For sourceWithExt In {1}t�.log  #only test files, which begins with a 't'
-  Set Exit 1 #Revert error handling
-
-  (Evaluate "{sourceWithExt}" =~ /(([�.])*)�1�/) > Dev:Null
-  Set apppath {�1}
-
-  (Evaluate {apppath} =~ /�:([�:]*)�1/) > Dev:Null
-  Set appname {�1}
-
-  If `Exists {apppath}.elg`
-    Continue
-  End
-
-  Set testdirectives ""
-  Set testdirectives "`StreamEdit {apppath}.pp �
-      -d -e "/�{[ �t]*(%�*)�1[ �t]*�}/ Print �1"`" > Dev:Null
-  Echo "============================================================="
-
-  If {debugverbose}
-    Echo {testdirectives}
-  End
-
-  If `Evaluate "{testdirectives}" =~ /�%CPU=([,_0-9A-Za-z]*)�1�/`
-    If `Evaluate "{�1}" !~ /�powerpc�/`
-      Echo Skipped {apppath}. Test only for CPU: "{�1}"
-      Continue
-    End
-  End
-  
-  If `Evaluate "{testdirectives}" =~ /�%SKIPCPU=([,_0-9A-Za-z]*)�1�/`
-    If `Evaluate "{�1}" =~ /�powerpc�/`
-      Echo Skipped {apppath}. Test not for CPU: {�1}
-      Continue
-    End
-  End
-  
-  If `Evaluate "{testdirectives}" =~ /�%TARGET=([,_0-9A-Za-z]*)�1�/`
-    If `Evaluate "{�1}" !~ /�macos�/`
-      Echo Skipped {apppath}. Test only for target: {�1}
-      Continue
-    End
-  End
-  
-  If `Evaluate "{testdirectives}" =~ /�%SKIPTARGET=([,_0-9A-Za-z]*)�1�/`
-    If `Evaluate "{�1}" =~ /�macos�/`
-      Echo Skipped {apppath}. Test not for target: {�1}
-      Continue
-    End
-  End
-
-  If `Evaluate "{testdirectives}" =~ /�%VERSION=([0-9.]*)�1�/`
-    Set minver {�1}
-    If `Evaluate "{minver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
-      If `Evaluate "{minver}" !~ /([0-9]*)�1.([0-9]*)�2/`
-        Echo Skipped {apppath}. Error in version no: {minver}
-        Continue
-      Else
-        Set �3 0
-      End
-    End
-    
-    If �(({cv1}> {�1}) || (({cv1}=={�1}) && �
-           (({cv2}> {�2}) || (({cv2}=={�2}) && �
-           ({cv3}>={�3})))))
-      Echo Skipped {apppath}. Compiler too old, test requires at least: {minver}
-      Continue
-    End
-  End
-  
-  If `Evaluate "{testdirectives}" =~ /�%MAXVERSION=([0-9.]*)�1�/`
-    Set maxver {�1}
-    If `Evaluate "{maxver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
-      If `Evaluate "{maxver}" !~ /([0-9]*)�1.([0-9]*)�2/`
-        Echo Skipped {apppath}. Error in version no: {maxver}
-        Continue
-      Else
-        Set �3 0
-      End
-    End
-    
-    If �(({cv1}< {�1}) || (({cv1}=={�1}) && �
-           (({cv2}< {�2}) || (({cv2}=={�2}) && �
-           ({cv3}<={�3})))))
-      Echo Skipped {apppath}. Compiler too new, test requires no more than: {maxver}
-      Continue
-    End
-  End
-
-  If `Evaluate "{testdirectives}" =~ /�%NOTE=([�%]*)�1�/`
-    Echo Note: {�1}
-  End
-
-  # Start compiling
-  Echo Start compiling "{apppath}"
-  
-
-  Set Exit 0
-  SetFile -c 'MPS ' -t 'TEXT' {appname}_ppas
-  
-  If {debugverbose}
-    Execute {appname}_ppas | Tee {apppath}.log
-  Else
-    Execute {appname}_ppas > {apppath}.log
-  End
-
-  If "{Status}" != 0
-    Set Exit 1
-    Echo Compiling of "{apppath}" failed
-    Set -e nrOfFailed `Evaluate {nrOfFailed}+1`
-    If {debugverbose}
-      StreamEdit  {apppath}.pp -d -e "1,15 Print"
-    End
-    Continue
-  Else
-    Set Exit 1
-    Echo Compiling of "{apppath}" succeded
-  End
-  
-  If `Evaluate "{testdirectives}" =~ /�%NORUN�/`
-    Echo Skipped running of {apppath} due to option NORUN
-    Continue
-  End
-
-  If `Evaluate "{testdirectives}" =~ /�%INTERACTIVE�/`
-    Echo Skipped running of {apppath} due to option INTERACTIVE
-    Continue
-  End
-
-  If Not `Exists {apppath}`
-    # Should this be counted as a failed test ?
-    # Or perhaps files is to be checked for if they are units ?
-    Echo Skipped running du to non existing executable
-    Continue
-  End
-
-  If 1
-    If `Evaluate "{testdirectives}" =~ /�%RESULT=([0-9]*)�1�/`
-      Set expectedresult {�1}
-    Else
-      Set expectedresult 0
-    End
-    
-    #Execute test program
-    Echo "Xxx" > "{apppath}.elg" #Needed, to continue if test app crashes
-    Set Exit 0
-    If {debugverbose}
-      {apppath} | Tee {apppath}.elg
-    Else
-      {apppath} > {apppath}.elg
-    End
-    Set actualresult {Status}
-    Set Exit 1
-
-    If {actualresult} != 0
-      Echo Running of "{apppath}" failed
-    Else
-      Echo Running of "{apppath}" succeded
-    End
-
-    Echo "Exit code was {actualresult}, expected {expectedresult}"
-    If "{actualresult}" != "{expectedresult}"
-      Echo -n "Failed to run {apppath}�r" >> log #�r gives a linefeed
-      Echo Failed test "{apppath}"
-      Set -e nrOfFailed `Evaluate {nrOfFailed}+1`
-      If {debugverbose}
-        StreamEdit  {apppath}.pp -d -e "1,15 Print"
-      End
-    Else
-      Echo -n "Successfully run {apppath}�r" >> log #�r gives a linefeed
-      Echo Succeded test "{apppath}"
-      Set -e nrOfSucceded `Evaluate {nrOfSucceded}+1`
-    End
-
-  End
-  Set Exit 0 # To handle the case, in the for stmt, when there is no match
-End
-Set Exit 1 #Revert error handling
+#Assembles, links and run tests of FreePascal
#Param 1, the directory with the tests to perform.
#Note versions can be either 2 or 3 fields, e g 1.1  1.0.10

Export nrOfSucceded
Export nrOfFailed

#Iterate through tests
Set Exit 0 # To handle the case, in the for stmt, when there is no match
For sourceWithExt In {1}t�.log  #only test files, which begins with a 't'
  Set Exit 1 #Revert error handling

  (Evaluate "{sourceWithExt}" =~ /(([�.])*)�1�/) > Dev:Null
  Set apppath {�1}

  (Evaluate {apppath} =~ /�:([�:]*)�1/) > Dev:Null
  Set appname {�1}

  If `Exists {apppath}.elg`
    Continue
  End

  Set testdirectives ""
  Set testdirectives "`StreamEdit {apppath}.pp �
      -d -e "/�{[ �t]*(%�*)�1[ �t]*�}/ Print �1"`" > Dev:Null
  Echo "============================================================="

  If {debugverbose}
    Echo {testdirectives}
  End

  If `Evaluate "{testdirectives}" =~ /�%CPU=([,_0-9A-Za-z]*)�1�/`
    If `Evaluate "{�1}" !~ /�powerpc�/`
      Echo Skipped {apppath}. Test only for CPU: "{�1}"
      Continue
    End
  End
  
  If `Evaluate "{testdirectives}" =~ /�%SKIPCPU=([,_0-9A-Za-z]*)�1�/`
    If `Evaluate "{�1}" =~ /�powerpc�/`
      Echo Skipped {apppath}. Test not for CPU: {�1}
      Continue
    End
  End
  
  If `Evaluate "{testdirectives}" =~ /�%TARGET=([,_0-9A-Za-z]*)�1�/`
    If `Evaluate "{�1}" !~ /�macos�/`
      Echo Skipped {apppath}. Test only for target: {�1}
      Continue
    End
  End
  
  If `Evaluate "{testdirectives}" =~ /�%SKIPTARGET=([,_0-9A-Za-z]*)�1�/`
    If `Evaluate "{�1}" =~ /�macos�/`
      Echo Skipped {apppath}. Test not for target: {�1}
      Continue
    End
  End

  If `Evaluate "{testdirectives}" =~ /�%VERSION=([0-9.]*)�1�/`
    Set minver {�1}
    If `Evaluate "{minver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
      If `Evaluate "{minver}" !~ /([0-9]*)�1.([0-9]*)�2/`
        Echo Skipped {apppath}. Error in version no: {minver}
        Continue
      Else
        Set �3 0
      End
    End
    
    If �(({cv1}> {�1}) || (({cv1}=={�1}) && �
           (({cv2}> {�2}) || (({cv2}=={�2}) && �
           ({cv3}>={�3})))))
      Echo Skipped {apppath}. Compiler too old, test requires at least: {minver}
      Continue
    End
  End
  
  If `Evaluate "{testdirectives}" =~ /�%MAXVERSION=([0-9.]*)�1�/`
    Set maxver {�1}
    If `Evaluate "{maxver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
      If `Evaluate "{maxver}" !~ /([0-9]*)�1.([0-9]*)�2/`
        Echo Skipped {apppath}. Error in version no: {maxver}
        Continue
      Else
        Set �3 0
      End
    End
    
    If �(({cv1}< {�1}) || (({cv1}=={�1}) && �
           (({cv2}< {�2}) || (({cv2}=={�2}) && �
           ({cv3}<={�3})))))
      Echo Skipped {apppath}. Compiler too new, test requires no more than: {maxver}
      Continue
    End
  End

  If `Evaluate "{testdirectives}" =~ /�%NOTE=([�%]*)�1�/`
    Echo Note: {�1}
  End

  # Start compiling
  Echo Start compiling "{apppath}"
  

  Set Exit 0
  SetFile -c 'MPS ' -t 'TEXT' {appname}_ppas
  
  If {debugverbose}
    (Execute {appname}_ppas; Set linkresult "{Status}") | Tee {apppath}.log
  Else
    Execute {appname}_ppas > {apppath}.log
    Set linkresult "{Status}"
  End

  If "{linkresult}" != 0
    Set Exit 1
    Echo Compiling of "{apppath}" failed
    Set -e nrOfFailed `Evaluate {nrOfFailed}+1`
    If {debugverbose}
      StreamEdit  {apppath}.pp -d -e "1,15 Print"
    End
    Continue
  Else
    Set Exit 1
    Echo Compiling of "{apppath}" succeded
  End
  
  If `Evaluate "{testdirectives}" =~ /�%NORUN�/`
    Echo Skipped running of {apppath} due to option NORUN
    Continue
  End

  If `Evaluate "{testdirectives}" =~ /�%INTERACTIVE�/`
    Echo Skipped running of {apppath} due to option INTERACTIVE
    Continue
  End

  If Not `Exists {apppath}`
    # Should this be counted as a failed test ?
    # Or perhaps files is to be checked for if they are units ?
    Echo Skipped running due to nonexisting executable
    Continue
  End

  If 1
    If `Evaluate "{testdirectives}" =~ /�%RESULT=([0-9]*)�1�/`
      Set expectedresult {�1}
    Else
      Set expectedresult 0
    End
    
    #Execute test program
    Echo "Xxx" > "{apppath}.elg" #Needed, to continue if test app crashes
    Set Exit 0
    If {debugverbose}
      ( {apppath} ; Set actualresult "{Status}" ) | Tee {apppath}.elg
    Else
      {apppath} > {apppath}.elg
      Set actualresult "{Status}"
    End
    Set Exit 1

    If {actualresult} != 0
      Echo Running of "{apppath}" failed
    Else
      Echo Running of "{apppath}" succeded
    End

    Echo "Exit code was {actualresult}, expected {expectedresult}"
    If "{actualresult}" != "{expectedresult}"
      Echo -n "Failed to run {apppath}�r" >> log #�r gives a linefeed
      Echo Failed test "{apppath}"
      Set -e nrOfFailed `Evaluate {nrOfFailed}+1`
      If {debugverbose}
        StreamEdit  {apppath}.pp -d -e "1,15 Print"
      End
    Else
      Echo -n "Successfully run {apppath}�r" >> log #�r gives a linefeed
      Echo Succeded test "{apppath}"
      Set -e nrOfSucceded `Evaluate {nrOfSucceded}+1`
    End

  End
  Set Exit 0 # To handle the case, in the for stmt, when there is no match
End
Set Exit 1 #Revert error handling
\ No newline at end of file
diff --git a/tests/utils/macos/LinkRunTests b/tests/utils/macos/LinkRunTests
index 74bda8bb4f..8cc57baa01 100644
--- a/tests/utils/macos/LinkRunTests
+++ b/tests/utils/macos/LinkRunTests
@@ -1,62 +1 @@
-#Assembles, links and run tests of FreePascal
-#Param 1, the directory with the tests to perform.
-#Note versions can be either 2 or 3 fields, e g 1.1  1.0.10
-
-(Evaluate {0} =~ /(�:)�1[�:]*/) > Dev:Null
-Set mydir {�1}
-
-Set -e debugverbose 1
-Echo "** Assembles, links and run tests for MacOS **" 
-
-#Delete -i �.o
-Set -e nrOfSucceded 0
-Set -e nrOfFailed 0
-
-#Set compiler version
-Set compver '1.9' #Must be at least two fields
-If `Evaluate "{compver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
-  If `Evaluate "{compver}" !~ /([0-9]*)�1.([0-9]*)�2/`
-    Echo Error in compiler version no
-    Exit 1
-  Else
-    Set �3 0
-  End
-End
-Set -e cv1 {�1};Set -e cv2 {�2}; Set -e cv3 {�3}
-
-Directory {1}units:
-
-#Iterate through files in :units:
-Set Exit 0 # To handle the case, in the for stmt, when there is no match
-For sourceWithExt In �.s
-  Set Exit 1 #Revert error handling
-  (Evaluate "{sourceWithExt}" =~ /(([�.])*)�1�/) > Dev:Null
-  Set unitname {�1}
-  If `Exists {unitname}.o`
-    Continue
-  End
-  SetFile -c 'MPS ' -t 'TEXT' {unitname}_ppas
-  Execute {unitname}_ppas
-  Set Exit 0 # To handle the case, in the for stmt, when there is no match
-End
-Set Exit 1 #Revert error handling
-
-Directory {1}
-
-{mydir}LinkRunDir ':test:'
-{mydir}LinkRunDir ':test:cg:'
-{mydir}LinkRunDir ':test:cg:cdecl:'
-{mydir}LinkRunDir ':test:units:system:'
-{mydir}LinkRunDir ':test:units:strings:'
-{mydir}LinkRunDir ':test:units:objects:'
-{mydir}LinkRunDir ':test:units:math:'
-{mydir}LinkRunDir ':test:opt:'
-{mydir}LinkRunDir ':tbs:'
-{mydir}LinkRunDir ':tbf:'
-{mydir}LinkRunDir ':webtbs:'
-{mydir}LinkRunDir ':webtbf:'
-
-Echo "============================================================="
-Echo '** Test session finished. **'
-Echo "No of succeded tests: {nrOfSucceded}"
-Echo "No of failed tests: {nrOfFailed}"
+#Assembles, links and run tests of FreePascal
#Param 1, the directory with the tests to perform.
#Note versions can be either 2 or 3 fields, e g 1.1  1.0.10

(Evaluate {0} =~ /(�:)�1[�:]*/) > Dev:Null
Set mydir {�1}

Set -e debugverbose 1
Echo "** Assembles, links and run tests for MacOS **" 

#Delete -i �.o
Set -e nrOfSucceded 0
Set -e nrOfFailed 0

#Set compiler version
Set compver '1.9' #Must be at least two fields
If `Evaluate "{compver}" !~ /([0-9]*)�1.([0-9]*)�2.([0-9]*)�3/`
  If `Evaluate "{compver}" !~ /([0-9]*)�1.([0-9]*)�2/`
    Echo Error in compiler version no
    Exit 1
  Else
    Set �3 0
  End
End
Set -e cv1 {�1};Set -e cv2 {�2}; Set -e cv3 {�3}

Directory {1}units:

#Iterate through files in :units:
Set Exit 0 # To handle the case, in the for stmt, when there is no match
For sourceWithExt In �.s
  Set Exit 1 #Revert error handling
  (Evaluate "{sourceWithExt}" =~ /(([�.])*)�1�/) > Dev:Null
  Set unitname {�1}
  If `Exists {unitname}.o`
    Continue
  End
  SetFile -c 'MPS ' -t 'TEXT' {unitname}_ppas
  Execute {unitname}_ppas
  Set Exit 0 # To handle the case, in the for stmt, when there is no match
End
Set Exit 1 #Revert error handling

Directory {1}

{mydir}LinkRunDir ':test:'
{mydir}LinkRunDir ':test:cg:'
{mydir}LinkRunDir ':test:cg:cdecl:'
{mydir}LinkRunDir ':test:units:system:'
{mydir}LinkRunDir ':test:units:strings:'
{mydir}LinkRunDir ':test:units:objects:'
{mydir}LinkRunDir ':test:units:math:'
{mydir}LinkRunDir ':test:opt:'
{mydir}LinkRunDir ':tbs:'
{mydir}LinkRunDir ':tbf:'
{mydir}LinkRunDir ':webtbs:'
{mydir}LinkRunDir ':webtbf:'

Echo "============================================================="
Echo '** Test session finished. **'
#duesnt work:
#Echo "No of succeded tests: {nrOfSucceded}"
#Echo "No of failed tests: {nrOfFailed}"
\ No newline at end of file