Skip to content

Instantly share code, notes, and snippets.

@slide
Created July 27, 2019 14:28
Show Gist options
  • Save slide/2d6b884113428e2dd002629963d1e26f to your computer and use it in GitHub Desktop.
Save slide/2d6b884113428e2dd002629963d1e26f to your computer and use it in GitHub Desktop.
@echo off
setlocal enableextensions
echo.
::Do a little environment variable shuffling to ensure we have a capital IP_ROOT set in this process
::and not a lower case variant as would be in the case when launched from mstest or vs (a bug)
if defined IP_ROOT (
set IP_ROOT_BACKUP=%IP_ROOT%
set IP_ROOT=
)
if defined IP_ROOT_BACKUP (
::Can't just define this in the conditional above for some reason (it won't persist)
set IP_ROOT=%IP_ROOT_BACKUP%
)
set CPY_VER=%DLR_ROOT%\External.LCA_RESTRICTED\Languages\IronPython\27\python.exe
if not exist "%CPY_VER%" (
::Hmm, this makes me wonder, maybe we should have a cpython.exe executable drop in the main depot, otherwise devs will be required to sync the external stuff. Not sure
echo CPython could not be found. Ensure that you have synchronized the external depot at %DLR_ROOT%\..\External.
echo Usage: _RunIP_SBS.bat ^<...\ipy.exe^> ^<...\sbs_yourtest.py^>
exit /B 1
)
if not exist "%2" (
echo Test case '%2' could not be found
echo Usage: _RunIP_SBS.bat ^<...\ipy.exe^> ^<...\sbs_yourtest.py^>
exit /B 2
)
if not exist "%1" (
echo IronPython at '%1' could not be found
echo Usage: _RunIP_SBS.bat ^<...\ipy.exe^> ^<...\sbs_yourtest.py^>
exit /B 3
)
::Finally, we can really run the tests.
echo Running: "%CPY_VER%" runsbs.py "%2"
"%CPY_VER%" runsbs.py "%2"
IF NOT %ERRORLEVEL% == 0 (
echo Fail CPython %ERRORLEVEL%
exit /B 1
)
::Run tests again under IronPython
::Notice that we're intentionally throwing away the value of TEST_OPTIONS
::here - it's not fair to compare apples to banannas!
echo Running: "%1" runsbs.py "%2"
"%1" runsbs.py "%2"
IF NOT %ERRORLEVEL% == 0 (
echo Fail IronPython %ERRORLEVEL%
exit /B 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment