RegressionTests__Win32OperatingSystemTest.st
branchjv
changeset 2608 b77fda6a2e98
parent 2607 ddf2eb8b3f1d
parent 2606 ca1a3083168c
equal deleted inserted replaced
2607:ddf2eb8b3f1d 2608:b77fda6a2e98
     2 
     2 
     3 "
     3 "
     4  COPYRIGHT (c) Claus Gittinger / eXept Software AG
     4  COPYRIGHT (c) Claus Gittinger / eXept Software AG
     5  COPYRIGHT (c) 2016 Jan Vrany
     5  COPYRIGHT (c) 2016 Jan Vrany
     6  COPYRIGHT (c) 2021 svestkap
     6  COPYRIGHT (c) 2021 svestkap
     7  COPYRIGHT (c) 2021 Patrik Svestka
     7  COPYRIGHT (c) 2021-2022 Patrik Svestka
     8  COPYRIGHT (c) 2022 Jan Vrany
     8  COPYRIGHT (c) 2022 Jan Vrany
     9               All Rights Reserved
     9               All Rights Reserved
    10 
    10 
    11  This software is furnished under a license and may be used
    11  This software is furnished under a license and may be used
    12  only in accordance with the terms of that license and with the
    12  only in accordance with the terms of that license and with the
   574 testExecWithTooLongCommandLine
   574 testExecWithTooLongCommandLine
   575     "Creating process with too long command line - should raise an exception"
   575     "Creating process with too long command line - should raise an exception"
   576     | beyondCreateProcessArgumentsLimit commandLine savedException |
   576     | beyondCreateProcessArgumentsLimit commandLine savedException |
   577     
   577     
   578     beyondCreateProcessArgumentsLimit := 4096.    
   578     beyondCreateProcessArgumentsLimit := 4096.    
   579     commandLine := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   579     commandLine := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   580     self assert: commandLine size = beyondCreateProcessArgumentsLimit.
   580     self assert: commandLine size = beyondCreateProcessArgumentsLimit.
   581     
   581     
   582     self should: [
   582     self should: [
   583         OperatingSystem exec: '' withArguments: commandLine
   583         OperatingSystem exec: '' withArguments: commandLine
   584                  environment:nil
   584                  environment:nil
   600     "Testing if the exception is proceedable and if it returns nil"
   600     "Testing if the exception is proceedable and if it returns nil"
   601     | beyondCreateProcessArgumentsLimit commandLine handle |
   601     | beyondCreateProcessArgumentsLimit commandLine handle |
   602     
   602     
   603     beyondCreateProcessArgumentsLimit := 4097.         
   603     beyondCreateProcessArgumentsLimit := 4097.         
   604     "/ created random String size 4097
   604     "/ created random String size 4097
   605     commandLine := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   605     commandLine := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   606     self assert: commandLine size = beyondCreateProcessArgumentsLimit.
   606     self assert: commandLine size = beyondCreateProcessArgumentsLimit.
   607     
   607     
   608     handle := Win32OperatingSystem::Win32ProcessHandle new.
   608     handle := Win32OperatingSystem::Win32ProcessHandle new.
   609     self assert: handle notNil.
   609     self assert: handle notNil.
   610     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   610     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   622     ]. 
   622     ]. 
   623     "/ after exception has occured, continue to see if handle is nil    
   623     "/ after exception has occured, continue to see if handle is nil    
   624     self assert: handle isNil.
   624     self assert: handle isNil.
   625 
   625 
   626     "Created: / 21-10-2021 / 12:17:02 / svestkap"
   626     "Created: / 21-10-2021 / 12:17:02 / svestkap"
       
   627     "Modified: / 20-05-2022 / 13:58:16 / Patrik Svestka <patrik.svestka@gmail.com>"
   627 !
   628 !
   628 
   629 
   629 testExecWithTooLongCommandPath
   630 testExecWithTooLongCommandPath
   630     "Creating process with too long command path - should raise an exception"
   631     "Creating process with too long command path - should raise an exception"
   631     | beyondCreateProcessArgumentsLimit commandPath savedException |
   632     | beyondCreateProcessArgumentsLimit commandPath savedException |
   632     
   633     
   633     beyondCreateProcessArgumentsLimit := 4096.
   634     beyondCreateProcessArgumentsLimit := 4096.
   634     commandPath := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   635     commandPath := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   635     self assert: commandPath size = beyondCreateProcessArgumentsLimit.
   636     self assert: commandPath size = beyondCreateProcessArgumentsLimit.
   636     
   637     
   637     self should: [
   638     self should: [
   638         OperatingSystem exec: commandPath withArguments: ''
   639         OperatingSystem exec: commandPath withArguments: ''
   639                  environment:nil
   640                  environment:nil
   655     "Testing if the exception is proceedable and if it returns nil"
   656     "Testing if the exception is proceedable and if it returns nil"
   656     | beyondCreateProcessArgumentsLimit commandPath handle |
   657     | beyondCreateProcessArgumentsLimit commandPath handle |
   657     
   658     
   658     beyondCreateProcessArgumentsLimit := 4097.
   659     beyondCreateProcessArgumentsLimit := 4097.
   659     "/ created random String size 4097
   660     "/ created random String size 4097
   660     commandPath := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   661     commandPath := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   661     self assert: commandPath size = beyondCreateProcessArgumentsLimit.
   662     self assert: commandPath size = beyondCreateProcessArgumentsLimit.
   662     
   663     
   663     handle := Win32OperatingSystem::Win32ProcessHandle new.
   664     handle := Win32OperatingSystem::Win32ProcessHandle new.
   664     self assert: handle notNil.
   665     self assert: handle notNil.
   665     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   666     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   677     ]. 
   678     ]. 
   678     "/ after exception has occured, continue to see if handle is nil    
   679     "/ after exception has occured, continue to see if handle is nil    
   679     self assert: handle isNil.
   680     self assert: handle isNil.
   680 
   681 
   681     "Created: / 21-10-2021 / 12:19:37 / svestkap"
   682     "Created: / 21-10-2021 / 12:19:37 / svestkap"
       
   683     "Modified: / 20-05-2022 / 13:58:03 / Patrik Svestka <patrik.svestka@gmail.com>"
   682 !
   684 !
   683 
   685 
   684 testExecWithTooLongDirName
   686 testExecWithTooLongDirName
   685     "Creating process with too long command path - should raise an exception"
   687     "Creating process with too long command path - should raise an exception"
   686     | beyondCreateProcessArgumentsLimit dirName savedException |
   688     | beyondCreateProcessArgumentsLimit dirName savedException |
   687     
   689     
   688     beyondCreateProcessArgumentsLimit := 4096.
   690     beyondCreateProcessArgumentsLimit := 4096.
   689     dirName := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   691     dirName := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   690     self assert: dirName size = beyondCreateProcessArgumentsLimit.
   692     self assert: dirName size = beyondCreateProcessArgumentsLimit.
   691     
   693     
   692     self should: [
   694     self should: [
   693         OperatingSystem exec: '' withArguments: ''
   695         OperatingSystem exec: '' withArguments: ''
   694                  environment:nil
   696                  environment:nil
   709 testExecWithTooLongDirName2
   711 testExecWithTooLongDirName2
   710     "Testing if the exception is proceedable and if it returns nil"
   712     "Testing if the exception is proceedable and if it returns nil"
   711     | beyondCreateProcessArgumentsLimit dirName handle |
   713     | beyondCreateProcessArgumentsLimit dirName handle |
   712     
   714     
   713     beyondCreateProcessArgumentsLimit := 4097.
   715     beyondCreateProcessArgumentsLimit := 4097.
   714     dirName := RandomGenerator new nextCharacters: beyondCreateProcessArgumentsLimit.
   716     dirName := RandomGenerator new nextLettersOrDigits: beyondCreateProcessArgumentsLimit.
   715     self assert: dirName size = beyondCreateProcessArgumentsLimit.
   717     self assert: dirName size = beyondCreateProcessArgumentsLimit.
   716     
   718     
   717     handle := Win32OperatingSystem::Win32ProcessHandle new.
   719     handle := Win32OperatingSystem::Win32ProcessHandle new.
   718     self assert: handle notNil.
   720     self assert: handle notNil.
   719     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   721     self assert: (handle isKindOf: Win32OperatingSystem::Win32ProcessHandle).
   731     ]. 
   733     ]. 
   732     "/ after exception has occured, continue to see if handle is nil    
   734     "/ after exception has occured, continue to see if handle is nil    
   733     self assert: handle isNil.
   735     self assert: handle isNil.
   734 
   736 
   735     "Created: / 21-10-2021 / 12:21:54 / svestkap"
   737     "Created: / 21-10-2021 / 12:21:54 / svestkap"
       
   738     "Modified: / 20-05-2022 / 13:35:31 / Patrik Svestka <patrik.svestka@gmail.com>"
   736 ! !
   739 ! !
   737 
   740 
   738 !Win32OperatingSystemTest methodsFor:'tests'!
   741 !Win32OperatingSystemTest methodsFor:'tests'!
   739 
   742 
   740 testMutex
   743 testMutex