diff --git a/.travis.yml b/.travis.yml index deee19ecbdf..68d10be7302 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,15 @@ dist: trusty os: - linux - osx + - windows # Use a Travis image containing an Xcode we support # This prevents surprise upgrades! osx_image: xcode7.3 -language: c++ +language: cpp -compiler: +compiler: - clang - gcc @@ -46,11 +47,13 @@ matrix: compiler: gcc - os: linux compiler: clang + - os: windows + compiler: clang # Install any required tools before_install: - | - if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then + if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then rvm --default use 2.2.1 gem install xcpretty fi @@ -59,13 +62,22 @@ before_install: if [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get -qq update - sudo apt-get -qq install g++-4.9 + sudo apt-get -qq install g++-4.9 + fi + + - | + if [[ "$TRAVIS_OS_NAME" == "windows" ]] ; then + choco install --yes cygwin -params '/InstallDir:C:\Cygwin' + choco install --yes --source cygwin bash curl zip unzip + choco install make + choco install winflexbison fi # Set up the source tree by fetching Linux-specific prebuilt objects install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then (cd prebuilt && ./fetch-libraries.sh linux x86_64) ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then (cd prebuilt && ./fetch-libraries.sh mac) ; fi + - if [[ "$TRAVIS_OS_NAME" == "windows" ]] ; then (cd prebuilt && ./fetch-libraries.sh win32 x86_64) ; fi # Bootstrap the LCB compiler, build the default target set and run a # the default test suite. @@ -89,8 +101,9 @@ script: | export JAVA_HOME=$(/usr/libexec/java_home) ;; esac - - if [[ "${COVERITY_SCAN_BRANCH}" != "1" ]]; then + if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then + cmd.exe /C configure.bat + elif [[ "${COVERITY_SCAN_BRANCH}" != "1" ]]; then mkdir -p "${LICENSE_DIR}" && touch "${LICENSE_DIR}/livecode-firstrun.lcf" && make all-${BUILD_PLATFORM} && diff --git a/Makefile.common b/Makefile.common index 864c64bb688..0e4bec41ee7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -50,13 +50,22 @@ guess_linux_arch_script := \ esac guess_linux_arch := $(shell $(guess_linux_arch_script)) -guess_platform_script := \ +guess_platform_no_arch_script := \ case `uname -s` in \ - Linux) echo linux-$(guess_linux_arch) ;; \ + Linux) echo linux ;; \ Darwin) echo mac ;; \ + MSYS*) echo win ;; \ esac +guess_platform_no_arch := $(shell $(guess_platform_no_arch_script)) + +guess_platform_script := \ + case `uname -s` in \ + Linux) echo linux-$(guess_linux_arch) ;; \ + Darwin) echo mac ;; \ + MSYS*) echo win-$(guess_linux_arch) ;; \ + esac guess_platform := $(shell $(guess_platform_script)) - + guess_engine_flags_script := \ if echo $(guess_platform) | grep "^linux" >/dev/null 2>&1 && \ ! xset -q >/dev/null 2>&1 ; then \ @@ -70,5 +79,20 @@ else bin_dir ?= $(top_srcdir)/$(guess_platform)-bin endif -guess_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/Standalone-Community.app/Contents/MacOS/Standalone-Community,$(bin_dir)/standalone-community) -guess_dev_engine := $(if $(filter mac,$(guess_platform)),$(bin_dir)/LiveCode-Community.app/Contents/MacOS/LiveCode-Community,$(bin_dir)/LiveCode-Community) +guess_engine_script := \ + case `uname -s` in \ + Linux) echo $(bin_dir)/standalone-community ;; \ + Darwin) echo $(bin_dir)/Standalone-Community.app/Contents/MacOS/Standalone-Community ;; \ + MSYS*) echo $(bin_dir)/standalone-community.exe ;; \ + esac +guess_engine := $(shell $(guess_engine_script)) + + +guess_dev_engine_script := \ + case `uname -s` in \ + Linux) echo $(bin_dir)/LiveCode-Community ;; \ + Darwin) echo $(bin_dir)/LiveCode-Community.app/Contents/MacOS/LiveCode-Community ;; \ + MSYS*) echo $(bin_dir)/LiveCode-Community.exe ;; \ + esac +guess_dev_engine := $(shell $(guess_dev_engine_script)) + diff --git a/buildbot.py b/buildbot.py index 3b2d16d4465..b94c421df8d 100755 --- a/buildbot.py +++ b/buildbot.py @@ -195,25 +195,23 @@ def __exit__(self, type, value, traceback): def exec_msbuild(platform): # Run the make.cmd batch script; it's run using Wine if this is # not actually a Windows system. - cwd = 'build-' + platform - if _platform.system() == 'Windows': with UniqueMspdbsrv() as mspdbsrv: - args = ['cmd', '/C', '..\\make.cmd'] + args = ['cmd', '/C', 'make.cmd'] print(' '.join(args)) - result = subprocess.call(args, cwd=cwd) + result = subprocess.call(args) sys.exit(result) else: - args = ['wine', 'cmd', '/K', '..\\make.cmd'] + args = ['wine', 'cmd', '/K', 'make.cmd'] print(' '.join(args)) - exit_status = sys.exit(subprocess.call(args, cwd=cwd)) + exit_status = sys.exit(subprocess.call(args)) # Clean up any Wine processes that are still hanging around. # This is important in case the build fails. args = ['wineserver', '-k', '-w'] - subprocess.call(args, cwd=cwd) + subprocess.call(args) sys.exit(exit_status) diff --git a/config/yacc.gypi b/config/yacc.gypi index c97da90df2e..e72b9358835 100644 --- a/config/yacc.gypi +++ b/config/yacc.gypi @@ -6,13 +6,32 @@ [ 'OS == "win"', { - 'variables': - { - 'invoke_unix_path': '$(ProjectDir)../../../../../util/invoke-unix.bat', - }, - - 'flex': ['<(invoke_unix_path)', '/usr/bin/flex'], - 'bison': ['<(invoke_unix_path)', '/usr/bin/bison'], + 'variables': + { + # Whether to use flex and bison installed via chocolatey winflexbison + # package or installed through Cygwin + 'use_winflexbison': ' kTestErrorDialogTimeout then + TestDiagnostic "Timed out waiting for error dialog for" && pErrorCode + exit repeat + end if + end repeat + TestAssert pDescription, TestErrorMatches(sError, pErrorCode) put empty into sError end TestAssertErrorDialog @@ -442,11 +455,17 @@ on TestLoadExternal pExternal local tBinariesPath, tExtension set the itemdelimiter to slash - if the platform is "MacOS" then - put "bundle" into tExtension - else if the platform is "linux" then - put "so" into tExtension - end if + switch the platform + case "MacOS" + put "bundle" into tExtension + break + case "Linux" + put "so" into tExtension + break + case "Win32" + put "dll" into tExtension + break + end switch put TestGetBinariesPath() into tBinariesPath @@ -619,7 +638,7 @@ end TestRepeat command TestRunStack pOptions, pStackFilePath, pArgs local tEnginePath set the itemDelimiter to ":" - put item 2 of the address into tEnginePath + put item 2 to -1 of the address into tEnginePath local tCommand put format("\"%s\" %s \"%s\" %s", tEnginePath, pOptions, pStackFilePath, pArgs) into tCommand @@ -729,27 +748,33 @@ command TestEnsureJVM TestSkipIfNot "jvm" if $JAVA_HOME is empty then - local tPath - switch the platform - case "MacOS" - put word 1 to -1 of shell("/usr/libexec/java_home") into tPath - break - case "Linux" - local tJAVAC - put "/bin/javac" into tJAVAC - put word 1 to -1 of shell("/usr/bin/env readlink -f /usr" & tJAVAC) into tPath - if there is a file tPath and tPath ends with tJAVAC then - set the itemDelimiter to slash - delete item -2 to -1 of tPath - end if - break - end switch + local tPath + put TestGetJavaHome() into tPath if there is a folder tPath then put tPath into $JAVA_HOME end if end if end TestEnsureJVM +function TestGetJavaHome + local tPath + switch the platform + case "MacOS" + put word 1 to -1 of shell("/usr/libexec/java_home") into tPath + break + case "Linux" + local tJAVAC + put "/bin/javac" into tJAVAC + put word 1 to -1 of shell("/usr/bin/env readlink -f /usr" & tJAVAC) into tPath + if there is a file tPath and tPath ends with tJAVAC then + set the itemDelimiter to slash + delete item -2 to -1 of tPath + end if + break + end switch + return tPath +end TestGetJavaHome + command TestPropRoundTrip pObjectType, pProperty, pValues local tStack put "TestRoundTrip" & pProperty into tStack diff --git a/tests/_testrunner.livecodescript b/tests/_testrunner.livecodescript index 25f049039da..10be618e616 100644 --- a/tests/_testrunner.livecodescript +++ b/tests/_testrunner.livecodescript @@ -120,13 +120,19 @@ private command runTestCommand pInfo, pScriptFile, pCommand end repeat put "invoke" && pScriptFile && pCommand after tCommandLine - + + local tHideConsoleWindows + put the hideConsoleWindows into tHideConsoleWindows + set the hideConsoleWindows to true + -- Invoke the test in a subprocess. This ensures that we can detect -- if a crash occurs local tTestOutput, tTestExitStatus put shell(tCommandLine) into tTestOutput put the result into tTestExitStatus + set the hideConsoleWindows to tHideConsoleWindows + -- The output from the subprocesses will be native encoded utf-8. put textDecode(tTestOutput, "utf8") into tTestOutput diff --git a/tests/lcs/core/array/combine.livecodescript b/tests/lcs/core/array/combine.livecodescript index e8f9f40b51d..0eb57acf57f 100644 --- a/tests/lcs/core/array/combine.livecodescript +++ b/tests/lcs/core/array/combine.livecodescript @@ -35,7 +35,9 @@ on TestCombineStrings sort lines of tArray by item 1 of each sort lines of tUncombinedData by item 1 of each - TestAssert "Combine strings", tUncombinedData is tArray + + TestAssertBroken "Combine strings", tUncombinedData is tArray, \ + "Bug 20964" end TestCombineStrings @@ -76,8 +78,9 @@ on TestCombineMixed sort lines of tArray by item 1 of each sort lines of tUncombinedData by item 1 of each - - TestAssert "Combine numbers and strings", tUncombinedData is tArray + + TestAssertBroken "Combine numbers and strings", \ + tUncombinedData is tArray, "Bug 20964" end TestCombineMixed diff --git a/tests/lcs/core/engine/clipboard.livecodescript b/tests/lcs/core/engine/clipboard.livecodescript index ae0e8925c73..d8ce99f6451 100644 --- a/tests/lcs/core/engine/clipboard.livecodescript +++ b/tests/lcs/core/engine/clipboard.livecodescript @@ -154,16 +154,22 @@ on TestClipboardTypeSelection end TestClipboardTypeSelection on TestClipboardMultipleTypes + local tFilePath, tNativeFilePath + put "/file/path" into tFilePath + put tFilePath into tNativeFilePath + if the platform is "win32" then + replace slash with backslash in tNativeFilePath + end if -- Tests whether the fullClipboardData can successfully hold multiple types of data simultaneously lock the clipboard set the fullClipboardData to empty set the fullClipboardData["text"] to "text" set the fullClipboardData["image"] to _TinyPNG() - set the fullClipboardData["files"] to "/file/path" + set the fullClipboardData["files"] to tFilePath set the fullClipboardData["private"] to "private" TestAssert "Multiple types: text", "text" is among the lines of the keys of the fullClipboardData and fullClipboardData["text"] is "text" TestAssert "Multiple types: image", "image" is among the lines of the keys of the fullClipboardData and fullClipboardData["image"] is _TinyPNG() - TestAssert "Multiple types: files", "files" is among the lines of the keys of the fullClipboardData and line 1 of fullClipboardData["files"] is "/file/path" + TestAssert "Multiple types: files", "files" is among the lines of the keys of the fullClipboardData and line 1 of fullClipboardData["files"] is tNativeFilePath TestAssert "Multiple types: private", "private" is among the lines of the keys of the fullClipboardData and fullClipboardData["private"] is "private" set the fullClipboardData to empty unlock the clipboard @@ -216,14 +222,9 @@ on TestClipboardPrivateKey TestAssert "helper changed clipboard externally", the result is 0 - if the platform is "Linux" then - TestAssertBroken "private key not present after external change", \ - "private" is not among the keys of the clipboardData, \ - "Bug 19117" - else - TestAssert "private key not present after external change", \ - "private" is not among the keys of the clipboardData - end if + TestAssertBroken "private key not present after external change", \ + "private" is not among the keys of the clipboardData, \ + "Bug 19117" end TestClipboardPrivateKey # This is a regression test for Bug 19084 diff --git a/tests/lcs/core/engine/engine.livecodescript b/tests/lcs/core/engine/engine.livecodescript index 6119ec1e7ac..7c663196da6 100644 --- a/tests/lcs/core/engine/engine.livecodescript +++ b/tests/lcs/core/engine/engine.livecodescript @@ -89,19 +89,20 @@ put "value" into gEvalGlobalsTest TestAssert "global variable added in the globals", "gEvalGlobalsTest" is among the items of the globals end TestGlobals - on TestMachine + constant kIphoneMachines = "iPod Touch,iPhone,iPhone Simulator,iPad,iPad Simulator" TestSkipIf "platform", "HTML5" -if the platform is "win32" then -TestAssert "Machine is x86", the machine is "x86" -else if the platform is "iphone" then -TestAssert "iPhone machine", the machine is "iPod Touch" or the machine is "iPhone" or the machine is "iPhone Simulator" or the machine is "iPad" or the machine is "iPad Simulator" -else -TestAssert "the machine is not empty", the machine is not empty -end if + if the platform is "win32" then + TestAssert "Windows machine", \ + the machine is among the items of "x86,x86_64" + else if the platform is "iphone" then + TestAssert "iPhone machine", \ + the machine is among the items of kIphoneMachines + else + TestAssert "the machine is not empty", the machine is not empty + end if end TestMachine - on TestCustomProperty create field "tf" set the text of field "tf" to "abcd" @@ -142,22 +143,19 @@ end TestPlatform on TestProcessor TestSkipIf "platform", "HTML5" -local tProcessors - -if the platform is "Win32" then -put "x86" into tProcessors -else if the platform is "android" then -put "arm,i386" into tProcessors -else if the platform is "iphone" then -put "arm,arm64,i386,x86_64" into tProcessors -else if the platform is among the items of "MacOS,Linux" then - // Mac and Linux - put "x86,x86_64" into tProcessors -else - -- Unknown platform for "the processor" -end if + local tProcessors + if the platform is "android" then + put "arm,i386" into tProcessors + else if the platform is "iphone" then + put "arm,arm64,i386,x86_64" into tProcessors + else if the platform is among the items of "MacOS,Linux,Win32" then + // Mac and Linux + put "x86,x86_64" into tProcessors + else + -- Unknown platform for "the processor" + end if -TestAssert "the processor is correct", the processor is among the items of tProcessors + TestAssert "the processor is correct", the processor is among the items of tProcessors end TestProcessor diff --git a/tests/lcs/core/engine/localproperties.livecodescript b/tests/lcs/core/engine/localproperties.livecodescript index a968125ff82..62c7d1798dc 100644 --- a/tests/lcs/core/engine/localproperties.livecodescript +++ b/tests/lcs/core/engine/localproperties.livecodescript @@ -195,8 +195,8 @@ on TestCenturyCutOff put "1/1/" & tCutOff + 1 into tDate convert tDate to dateItems - TestAssert "centuryCutOff, above", item 1 of tDate is ("19" & tCutOff + 1) - + TestAssertBroken "centuryCutOff, above", item 1 of tDate is ("19" & tCutOff + 1), "Bug 12866" + // Set the date below the centurycutoff put "1/1/" & tCutOff - 1 into tDate convert tDate to dateitems diff --git a/tests/lcs/core/engine/resources.livecodescript b/tests/lcs/core/engine/resources.livecodescript index 3122ace3351..d24d33564e1 100644 --- a/tests/lcs/core/engine/resources.livecodescript +++ b/tests/lcs/core/engine/resources.livecodescript @@ -24,23 +24,16 @@ on TestModuleWithResourcesFolder set the itemdelimiter to slash local tFolder put item 1 to -2 of the effective filename of me into tFolder - load extension from file "../_tests/_build/lcs/core/engine/_resources.lcm" \ - with resource path tFolder - if the result is not empty then - throw "Failed to load test support extension:" && the result - end if + TestLoadAuxiliaryExtension "_resources", tFolder TestAssert "module with resources folder returns non-nothing", \ ResourcesGetMyResourcesFolder() is not empty end TestModuleWithResourcesFolder on TestModuleWithoutResourcesFolder - load extension from file "../_tests/_build/lcs/core/engine/_resources.lcm" - if the result is not empty then - throw "Failed to load test support extension:" && the result - end if - + TestLoadAuxiliaryExtension "_resources" + TestAssert "module without resources folder returns nothing", \ ResourcesGetMyResourcesFolder() is empty end TestModuleWithoutResourcesFolder diff --git a/tests/lcs/core/engine/widget.livecodescript b/tests/lcs/core/engine/widget.livecodescript index 899a07b7a14..bc1d299adc6 100644 --- a/tests/lcs/core/engine/widget.livecodescript +++ b/tests/lcs/core/engine/widget.livecodescript @@ -52,27 +52,46 @@ end TestWidgetBindErrorsDontEscape ////////// private command _DoTestWidgetScriptObjectAccess pMode + create stack "WidgetScriptAccessTest" + set the defaultStack to "WidgetScriptAccessTest" + + create widget "Test" as "com.livecode.lcs_tests.core.widget" + set the behavior of it to the long id of me + set the testMode of widget "Test" to pMode + local tVar export widget "Test" to array tVar TestAssertErrorDialog "no script access allowed for" && pMode, \ "EE_EXTENSION_ERROR_DOMAIN" + + delete stack "WidgetScriptAccessTest" end _DoTestWidgetScriptObjectAccess -on TestWidgetScriptObjectAccess - create stack "WidgetScriptAccessTest" - set the defaultStack to "WidgetScriptAccessTest" +on TestWidgetScriptObjectAccessResolve + _DoTestWidgetScriptObjectAccess "resolve" +end TestWidgetScriptObjectAccessResolve - create widget "Test" as "com.livecode.lcs_tests.core.widget" - set the behavior of it to the long id of me +on TestWidgetScriptObjectAccessGet + _DoTestWidgetScriptObjectAccess "get" +end TestWidgetScriptObjectAccessGet - repeat for each item tMode in "resolve,get,set,send,post,execute" - _DoTestWidgetScriptObjectAccess tMode - end repeat +on TestWidgetScriptObjectAccessSet + _DoTestWidgetScriptObjectAccess "set" +end TestWidgetScriptObjectAccessSet - delete stack "WidgetScriptAccessTest" -end TestWidgetScriptObjectAccess +on TestWidgetScriptObjectAccessSend + _DoTestWidgetScriptObjectAccess "send" +end TestWidgetScriptObjectAccessSend + +on TestWidgetScriptObjectAccessPost + _DoTestWidgetScriptObjectAccess "post" +end TestWidgetScriptObjectAccessPost + +on TestWidgetScriptObjectAccessExcecute + _DoTestWidgetScriptObjectAccess "execute" +end TestWidgetScriptObjectAccessExcecute on TestWidgetThrowInOnCreate create stack "WidgetThrowOnSaveTest" diff --git a/tests/lcs/core/field/pageHeights.livecodescript b/tests/lcs/core/field/pageHeights.livecodescript index 26b5d3208db..ee05eafcaa5 100644 --- a/tests/lcs/core/field/pageHeights.livecodescript +++ b/tests/lcs/core/field/pageHeights.livecodescript @@ -33,10 +33,10 @@ on TestPageHeights local tFieldContentFilename set the itemDel to slash - put item 1 to -2 of the filename of this stack into tFieldContentFilename - put slash & "_pageHeightsFieldContent.txt" after tFieldContentFilename - set the htmlText of field "testPageHeightsField" to url ("file:/"&tFieldContentFilename) - + put the filename of this stack into tFieldContentFilename + put "_pageHeightsFieldContent.txt" into item -1 of tFieldContentFilename + set the htmlText of field "testPageHeightsField" to url ("file:"&tFieldContentFilename) + TestAssert "Field is not empty", field "testPageHeightsField" is not empty local tObservedPageHeights diff --git a/tests/lcs/core/files/files.livecodescript b/tests/lcs/core/files/files.livecodescript index 02a4afe13d0..0f11dbb871d 100644 --- a/tests/lcs/core/files/files.livecodescript +++ b/tests/lcs/core/files/files.livecodescript @@ -287,20 +287,8 @@ end TestDeleteFile on TestLaunch local taskList - - if the platform is "Win32" then - put shell("tasklist /V") into taskList - - if taskList contains "notepad.exe" then - get shell("taskkill /IM notepad.exe") - end if - - launch "notepad.exe" - - put shell("tasklist /V") into taskList - - TestAssert "Notepad has been launched", taskList contains "notepad.exe" - else if the platform is "MacOS" then + + if the platform is "MacOS" then put shell("ps -ax") into taskList launch (specialfolderpath("apps") & slash & "textEdit.app") @@ -334,19 +322,9 @@ on TestLaunchWith local taskList put the openFiles into taskList - - if the platform is "Win32" then - launch "Test.txt" with "notepad" - - put shell("tasklist /V") into taskList - - TestAssert "file Text.txt lauched with Notepad", taskList contains "notepad.exe" - - get shell("taskkill /IM notepad.exe") - - delete file "Test.txt" - else if the platform is "MacOS" then - + + if the platform is "MacOS" then + launch "Test.txt" with (specialfolderpath("apps") & slash & "textEdit.app") put shell("ps -ax") into taskList diff --git a/tests/lcs/core/interface/interface.livecodescript b/tests/lcs/core/interface/interface.livecodescript index fa94f198877..65cbf309ecf 100644 --- a/tests/lcs/core/interface/interface.livecodescript +++ b/tests/lcs/core/interface/interface.livecodescript @@ -425,8 +425,8 @@ on TestWaitDepth "end waitDepthTest" send "waitDepthTest" to button 1 in 0 seconds - wait 0 seconds with messages - + wait 1 second with messages + TestAssert "Waitdepth increases", gWaitDepthTestResult is (1 + the waitdepth) end TestWaitDepth diff --git a/tests/lcs/core/logic/logic.livecodescript b/tests/lcs/core/logic/logic.livecodescript index 4082b6941bd..21b1dcb193a 100644 --- a/tests/lcs/core/logic/logic.livecodescript +++ b/tests/lcs/core/logic/logic.livecodescript @@ -52,8 +52,12 @@ private function IsMacDesktop return true end IsMacDesktop -private command __checkVariableType pVariable, pType +private command __checkVariableType pVariable, pType, pSkip, pReason repeat for each item tType in kIsA_types + if tType is among the items of pSkip then + TestSkip merge("'Variable containing '[[pVariable]]' is a [[tType]]"), pReason + next repeat + end if if tType is among the items of pType then TestAssert _fixSharp(merge("'Variable containing '[[pVariable]]' is a [[tType]]")), value("pVariable is a " & tType) else @@ -155,10 +159,18 @@ on TestIsA __checkVariableType "some text", "ascii string" // numToChar(128) - __checkVariableType numToChar(128), "" + if the platform is "win32" then + __checkVariableType numToChar(128), "", "date", "Bug 20966" + else + __checkVariableType numToChar(128), "" + end if // Unicode string - __checkVariableType "ыщьуерштп", "" + if the platform is "win32" then + __checkVariableType "ыщьуерштп", "", "date", "Bug 20966" + else + __checkVariableType "ыщьуерштп", "" + end if // Empty __checkVariableType empty, "" diff --git a/tests/lcs/core/network/network.livecodescript b/tests/lcs/core/network/network.livecodescript index 0a79bb11643..c0352ec2abf 100644 --- a/tests/lcs/core/network/network.livecodescript +++ b/tests/lcs/core/network/network.livecodescript @@ -206,12 +206,29 @@ on TestOpenSocketFromSameHostDifferentAddress end if end TestOpenSocketFromSameHostDifferentAddress +constant kSocketTimeout = 2000 on TestOpenSocketFromWithAddressUsingLocalServer - accept connections on port "8008" with message "connectedPlaceHolder" - wait until "8008" is among the lines of the openSockets with messages + local tPort + put 8008 into tPort + accept connections on port tPort with message "connectedPlaceHolder" + + local tMillisecs + put the millisecs into tMillisecs + repeat forever + wait for 0 with messages + if tPort is among the lines of the openSockets then + exit repeat + end if + if the millisecs - tMillisecs > kSocketTimeout then + exit repeat + end if + end repeat - open socket from "127.0.0.1" to "127.0.0.1:8008" - TestAssert "open socket from with local address to local server", "127.0.0.1:8008" is among the lines of the openSockets + local tTarget + put "127.0.0.1:" & tPort into tTarget + open socket from "127.0.0.1" to tTarget + TestAssert "open socket from with local address to local server", \ + tTarget is among the lines of the openSockets repeat for each line tSocket in the openSockets close socket tSocket @@ -219,18 +236,43 @@ on TestOpenSocketFromWithAddressUsingLocalServer end TestOpenSocketFromWithAddressUsingLocalServer on TestOpenSocketFromWithAddressAndPortUsingLocalServer - accept connections on port "8009" with message "connectedPlaceHolder" - wait until "8009" is among the lines of the openSockets with messages + local tPort + put 8009 into tPort + accept connections on port tPort with message "connectedPlaceHolder" + + local tMillisecs + put the millisecs into tMillisecs + repeat forever + wait for 0 with messages + if tPort is among the lines of the openSockets then + exit repeat + end if + if the millisecs - tMillisecs > kSocketTimeout then + exit repeat + end if + end repeat - open socket from "127.0.0.1:8010" to "127.0.0.1:8009" - TestAssert "open socket from with local address and port to local server", "127.0.0.1:8009" is among the lines of the openSockets + local tSource, tTarget + put "127.0.0.1:" & (tPort + 1) into tSource + put "127.0.0.1:" & tPort into tTarget - close socket "127.0.0.1:8010" - close socket "127.0.0.1:8009" - close socket "8009" + open socket from tSource to tTarget + TestAssert "open socket from with local address and port to local server", \ + tTarget is among the lines of the openSockets + + close socket tSource + close socket tTarget + close socket tPort end TestOpenSocketFromWithAddressAndPortUsingLocalServer on TestAcceptConnectionsInEphemeralPortRange + if the platform is "win32" and \ + the environment is "server" then + TestAssertBroken "Accept connections on emphemeral port", false, \ + "Bug 22153" + exit TestAcceptConnectionsInEphemeralPortRange + end if + -- in lieu of coming up with a per-OS/config list of ephemeral ranges -- we will just test if the port opened is greater than 1024 which -- is the bare minimum for BSD sockets then try and connect to it diff --git a/tests/lcs/docs/docsparser.livecodescript b/tests/lcs/docs/docsparser.livecodescript index 0b34fc77726..c73da7772ec 100644 --- a/tests/lcs/docs/docsparser.livecodescript +++ b/tests/lcs/docs/docsparser.livecodescript @@ -18,11 +18,9 @@ along with LiveCode. If not see . */ on TestSetup TestSkipIfNot "docs" - + -- Only run these tests on desktop platforms - if the platform is not among the items of "MacOS,Windows,Linux" then - return "SKIP Tests are not runnable on" && the platform - end if + TestSkipIfNot "desktop" local tDocsParser put TestGetEngineRepositoryPath() & "/ide-support/revdocsparser.livecodescript" into tDocsParser diff --git a/tests/lcs/docs/validate-dictionary.livecodescript b/tests/lcs/docs/validate-dictionary.livecodescript index 5f5f8ca97ac..90f81d2afbb 100644 --- a/tests/lcs/docs/validate-dictionary.livecodescript +++ b/tests/lcs/docs/validate-dictionary.livecodescript @@ -25,10 +25,8 @@ on TestSetup TestSkipIfNot "docs" -- Only run these tests on desktop platforms - if the platform is not among the items of "MacOS,Windows,Linux" then - return "SKIP Tests are not runnable on" && the platform - end if - + TestSkipIfNot "desktop" + local tDocsParser put TestGetEngineRepositoryPath() & "/ide-support/revdocsparser.livecodescript" into tDocsParser start using stack tDocsParser diff --git a/tests/lcs/liburl/connect.livecodescript b/tests/lcs/liburl/connect.livecodescript index 2f5991ddf73..96ce3895261 100644 --- a/tests/lcs/liburl/connect.livecodescript +++ b/tests/lcs/liburl/connect.livecodescript @@ -1,10 +1,10 @@ script "TestLibUrlCONNECT" on TestSetup - TestSkipIfNot "platform", "MacOS,Windows,Linux" + TestSkipIfNot "desktop" TestSkipIf "stack", "StandaloneTestRunnerMainstack" TestSkipIf "environment", "server" - + local tLibURl put TestGetEngineRepositoryPath() & "/ide-support/revliburl.livecodescript" into tLibUrl send "extensionInitialize" to stack tLibUrl @@ -22,5 +22,5 @@ on TestCONNECTHeader put "CONNECT" && kTestHost & ":443 HTTP/1.1" & cr & \ "Host: " & kTestHost & ":443" into tExpectedHeader - TestAssert "correct CONNECT header", tHeaders is tExpectedHeader + TestAssertBroken "correct CONNECT header", tHeaders is tExpectedHeader, "bug 22155" end TestCONNECTHeader diff --git a/tests/lcs/liburl/forms.livecodescript b/tests/lcs/liburl/forms.livecodescript index 6cc1de01558..13df926df8f 100644 --- a/tests/lcs/liburl/forms.livecodescript +++ b/tests/lcs/liburl/forms.livecodescript @@ -1,7 +1,7 @@ script "TestlibUrlForms" on TestSetup - TestSkipIfNot "platform", "MacOS,Windows,Linux" + TestSkipIfNot "desktop" TestSkipIf "environment", "server" if not TestIsInStandalone() then diff --git a/tests/lcs/liburl/headers.livecodescript b/tests/lcs/liburl/headers.livecodescript index b0b3f184e95..f576c628155 100644 --- a/tests/lcs/liburl/headers.livecodescript +++ b/tests/lcs/liburl/headers.livecodescript @@ -3,7 +3,7 @@ local sLogField on TestSetup - TestSkipIfNot "platform", "MacOS,Windows,Linux" + TestSkipIfNot "desktop" TestSkipIf "stacks loaded", "tsNetLibURL" TestSkipIf "environment", "server" diff --git a/tests/lcs/liburl/status_codes.livecodescript b/tests/lcs/liburl/status_codes.livecodescript index fe4b1cde7c8..9f8a4b893bd 100644 --- a/tests/lcs/liburl/status_codes.livecodescript +++ b/tests/lcs/liburl/status_codes.livecodescript @@ -3,9 +3,9 @@ script "TestLibUrlStatusCodes" local sLogField on TestSetup - TestSkipIfNot "platform", "MacOS,Windows,Linux" + TestSkipIfNot "desktop" TestSkipIf "environment", "server" - + if not TestIsInStandalone() then local tLibURl put TestGetEngineRepositoryPath() & "/ide-support/revliburl.livecodescript" into tLibUrl @@ -15,6 +15,10 @@ end TestSetup on TestStatusCodes + if the platform is "win32" then + TestAssertBroken "libUrl status codes", false, "bug 22154" + exit TestStatusCodes + end if # Response Code 204 set the socketTimeoutInterval to 10000 put the milliseconds into tStartTime diff --git a/tools/editbin.py b/tools/editbin.py new file mode 100644 index 00000000000..100a325d999 --- /dev/null +++ b/tools/editbin.py @@ -0,0 +1,35 @@ +import sys +import struct +import os + +if len(sys.argv) < 2: + print "Change Exe Run Mode Application by burlachenkok@gmail.com\nNot sufficient parametrs. 'exe_src_name.exe'" + sys.exit(-1) + +source_file = sys.argv[1] +dest_file = source_file + '_console' + +source = open(source_file, "rb") +dest = open(dest_file, "w+b") +dest.write(source.read()) + +dest.seek(0x3c) +(PeHeaderOffset,)=struct.unpack("H", dest.read(2)) + +dest.seek(PeHeaderOffset) +(PeSignature,)=struct.unpack("I", dest.read(4)) +if PeSignature != 0x4550: + print "Error in Find PE header" + +dest.seek(PeHeaderOffset + 0x5C) + +# console mode +dest.write(struct.pack("H", 0x03)) + +source.close() +dest.close() + +os.remove(source_file) +os.rename(dest_file, source_file) + +print "Completed succesfully.."