2014-03-30 23:43:22 +04:00
|
|
|
# Openscad Test Console
|
|
|
|
#
|
|
|
|
# Script to make it easier to pull up a command-line console or
|
|
|
|
# running Ctest under Windows(TM)
|
|
|
|
#
|
|
|
|
# public domain, by Don Bright <hugh.m.bright@gmail.com>
|
|
|
|
|
2014-03-30 21:23:58 +04:00
|
|
|
import os,sys
|
|
|
|
|
|
|
|
thisfile_abspath=os.path.abspath(__file__)
|
|
|
|
thisdir_abspath=os.path.abspath(os.path.dirname(thisfile_abspath))
|
|
|
|
|
|
|
|
starting_dir=os.path.join(thisdir_abspath,'tests-build')
|
|
|
|
print 'changing current folder to '+starting_dir
|
|
|
|
os.chdir(starting_dir)
|
|
|
|
|
|
|
|
print 'adding ',starting_dir,'folder to sys.path'
|
|
|
|
sys.path.append(starting_dir)
|
2014-03-31 00:48:59 +04:00
|
|
|
|
|
|
|
build_dir=starting_dir
|
2014-03-30 21:23:58 +04:00
|
|
|
|
|
|
|
print 'converting CTestTestfile.cmake by calling mingw_convert_test.py'
|
|
|
|
import mingw_convert_ctest
|
|
|
|
mingw_convert_ctest.run()
|
|
|
|
|
2014-03-30 22:01:39 +04:00
|
|
|
print 'searching for ctest.exe'
|
|
|
|
ctestpath=''
|
|
|
|
for basedir in 'C:/Program Files','C:/Program Files (x86)':
|
|
|
|
if os.path.isdir(basedir):
|
2014-03-30 23:43:22 +04:00
|
|
|
pflist = os.listdir(basedir)
|
|
|
|
for subdir in pflist:
|
|
|
|
if 'cmake' in subdir.lower():
|
2014-03-31 00:48:59 +04:00
|
|
|
abssubdir=os.path.join(basedir,subdir)
|
|
|
|
for root,dirs,files in os.walk(abssubdir):
|
2014-03-30 23:43:22 +04:00
|
|
|
if 'ctest.exe' in files:
|
|
|
|
ctestpath=os.path.join(root,'ctest.exe')
|
|
|
|
|
2014-03-30 22:01:39 +04:00
|
|
|
if not os.path.isfile(ctestpath):
|
|
|
|
print 'error, cant find ctest.exe'
|
|
|
|
else:
|
|
|
|
ctestdir = os.pathsep + os.path.dirname(ctestpath)
|
|
|
|
print 'adding ctest dir to PATH:',ctestdir
|
|
|
|
os.environ['PATH'] += ctestdir
|
|
|
|
|
2014-03-30 21:23:58 +04:00
|
|
|
#cmd = 'start "OpenSCAD Test console" /wait /d c:\\temp cmd.exe'
|
|
|
|
#cmd = 'start /d "'+starting_dir+'" cmd.exe "OpenSCAD Test Console"'
|
2014-03-31 00:48:59 +04:00
|
|
|
conbat=os.path.join(build_dir,'mingwcon.bat')
|
2014-04-01 04:58:01 +04:00
|
|
|
cmd = 'start /d "'+starting_dir+'" cmd.exe "/k" "'+conbat+'"'
|
2014-03-30 21:23:58 +04:00
|
|
|
print 'opening console: running ',cmd
|
|
|
|
os.system( cmd )
|
|
|
|
|
|
|
|
# figure out how to run convert script
|
|
|
|
# dont use mingw64 in linbuild path?
|
|
|
|
# figure out better windows prompt, can it be set?
|
|
|
|
|
2014-03-30 23:43:22 +04:00
|
|
|
|