mirror of https://github.com/vitalif/openscad
MXE cross build of tests: polish the scripts, introduce conversion script
for CTestmaster
parent
80b226bbe4
commit
53a0f9c4cf
|
@ -146,6 +146,8 @@ if [ ! $NUMCPU ]; then
|
|||
fi
|
||||
echo "NUMCPU: " $NUMCPU
|
||||
|
||||
|
||||
|
||||
case $OS in
|
||||
LINUX|MACOSX)
|
||||
TARGET=
|
||||
|
@ -244,13 +246,18 @@ if [ $BUILD_TESTS ]; then
|
|||
case $OS in
|
||||
UNIX_CROSS_WIN)
|
||||
TESTBUILD_MACHINE=x86_64-w64-mingw32
|
||||
# dont use build-machine trilpe in TESTBINDIR because the 'mingw32'
|
||||
# will confuse people who are on 64 bit machines
|
||||
TESTBINDIR=build-mingw$ARCH
|
||||
export TESTBUILD_MACHINE
|
||||
export TESTBINDIR
|
||||
if [[ $ARCH == 32 ]]; then
|
||||
TESTBUILD_MACHINE=i686-pc-mingw32
|
||||
fi
|
||||
cd tests
|
||||
mkdir build-mingw$ARCH
|
||||
cd build-mingw$ARCH
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../CMingw-cross-env.cmake \
|
||||
cd $OPENSCADDIR
|
||||
mkdir $TESTBINDIR
|
||||
cd $TESTBINDIR
|
||||
cmake ../tests/ -DCMAKE_TOOLCHAIN_FILE=../tests/CMingw-cross-env.cmake \
|
||||
-DMINGW_CROSS_ENV_DIR=$MXEDIR \
|
||||
-DMACHINE=$TESTBUILD_MACHINE
|
||||
if [ $FAKEMAKE = "tests" ]; then
|
||||
|
@ -416,45 +423,73 @@ if [ $BUILD_TESTS ]; then
|
|||
echo 'building regression test package on Win not implemented'
|
||||
;;
|
||||
UNIX_CROSS_WIN)
|
||||
INSTFILE=OpenSCAD-Tests-$VERSION-x86-$ARCH-Installer.exe
|
||||
# Build a .zip file containing all the files we need to run a
|
||||
# ctest on Windows(TM). For the sake of simplicity, we do not
|
||||
# create an installer for the tests.
|
||||
|
||||
echo "Copying files..."
|
||||
cd $OPENSCADDIR
|
||||
cd ..
|
||||
# This copies a lot of unnecessary stuff but that's OK.
|
||||
# as above, we use tar as a somewhat portable way to do 'exclude'
|
||||
# while copying.
|
||||
rm -f ./ostests.tar
|
||||
for subdir in tests testdata libraries examples $TESTBINDIR; do
|
||||
tar prvf ./ostests.tar --exclude=.git* --exclude=*/mingw64/* --exclude=*/mingw32/* --exclude=*.cc.obj --exclude=*.a $subdir
|
||||
done
|
||||
|
||||
if [ -e ./OpenSCAD-Tests-$VERSION ]; then
|
||||
rm -rf ./OpenSCAD-Tests-$VERSION
|
||||
fi
|
||||
mkdir OpenSCAD-Tests-$VERSION
|
||||
# this copies a lot of unnecessary stuff but that's OK.
|
||||
# as above, we use tar as a somewhat portable way to do 'exclude'
|
||||
# while copying.
|
||||
rm -f ostests.tar
|
||||
tar pcvf ostests.tar --exclude=.git* --exclude=*/mingw64/* --exclude=*/mingw32/* openscad --exclude=*.cc.obj --exclude=*.a
|
||||
mkdir OpenSCAD-Tests-$VERSION
|
||||
cd OpenSCAD-Tests-$VERSION
|
||||
tar pxf ../ostests.tar
|
||||
cd ..
|
||||
rm -f ostests.tar
|
||||
|
||||
echo "Copying mingw_x_testfile.py for ease of calling"
|
||||
cd OpenSCAD-Tests-$VERSION/openscad/tests
|
||||
cp -v ./mingw_x_testfile.py ./build-mingw$ARCH/mingw_x_testfile.py
|
||||
cd ../../..
|
||||
# Now we have the basic files copied into our tree that will become
|
||||
# our .zip file. We also want to move some files around for easier
|
||||
# access for the user:
|
||||
cd $OPENSCADDIR
|
||||
cd ./OpenSCAD-Tests-$VERSION
|
||||
echo "Copying files for ease of use when running from cmdline"
|
||||
cp -v ./tests/OpenSCAD_Test_Console.py .
|
||||
cp -v ./tests/mingw_convert_ctest.py ./$TESTBINDIR
|
||||
|
||||
echo "Creating mingw_cross_info.py file"
|
||||
cd OpenSCAD-Tests-$VERSION/openscad/tests
|
||||
rm -f ./mingw_cross_info.py
|
||||
echo "# created automatically by release-common.sh " >> mingw_cross_info.py
|
||||
echo "linux_basedir='"$OPENSCADDIR"'" >> mingw_cross_info.py
|
||||
echo "linux_builddir='"$OPENSCADDIR"/tests/binx_"$TESTBUILD_MACHINE"'" >> mingw_cross_info.py
|
||||
echo "bindir='binx_"$TESTBUILD_MACHINE"'" >> mingw_cross_info.py
|
||||
# fixme .. parse CTestTestfiles to find linux+convert python strings
|
||||
# or have CMake itself dump them during it's cross build cmake call
|
||||
echo "linux_python='"`which python`"'" >> mingw_cross_info.py
|
||||
echo "linux_convert='"`which convert`"'" >> mingw_cross_info.py
|
||||
echo "win_installdir='OpenSCAD_Tests_"$VERSIONDATE"'" >> mingw_cross_info.py
|
||||
cp -v mingw_cross_info.py ./build-mingw$ARCH/mingw_cross_info.py
|
||||
cd ../../..
|
||||
echo "Creating mingw_cross_info.py file"
|
||||
cd $OPENSCADDIR
|
||||
cd OpenSCAD-Tests-$VERSION
|
||||
cd $TESTBINDIR
|
||||
if [ -e ./mingw_cross_info.py ]; then
|
||||
rm -f ./mingw_cross_info.py
|
||||
fi
|
||||
echo "# created automatically by release-common.sh from within linux " >> mingw_cross_info.py
|
||||
echo "linux_abs_basedir='"$OPENSCADDIR"'" >> mingw_cross_info.py
|
||||
echo "linux_abs_builddir='"$OPENSCADDIR/$TESTBINDIR"'" >> mingw_cross_info.py
|
||||
echo "bindir='"$TESTBINDIR"'" >> mingw_cross_info.py
|
||||
# fixme .. parse CTestTestfiles to find linux+convert python strings
|
||||
# or have CMake itself dump them during it's cross build cmake call
|
||||
echo "linux_python='"`which python`"'" >> mingw_cross_info.py
|
||||
echo "linux_convert='"`which convert`"'" >> mingw_cross_info.py
|
||||
echo "win_installdir='OpenSCAD_Tests_"$VERSIONDATE"'" >> mingw_cross_info.py
|
||||
|
||||
# Test binaries can be hundreds of megabytes due to debugging info.
|
||||
# By default, we strip that. In most cases we wont need it if
|
||||
# the files are too big it will drive away potential users.
|
||||
echo "stripping .exe binaries"
|
||||
cd $OPENSCADDIR
|
||||
cd OpenSCAD-Tests-$VERSION
|
||||
cd $TESTBINDIR
|
||||
if [ "`command -v $TESTBUILD_MACHINE'-strip' `" ]; then
|
||||
for exefile in *exe; do
|
||||
ls -sh $exefile
|
||||
echo $TESTBUILD_MACHINE'-strip' $exefile
|
||||
$TESTBUILD_MACHINE'-strip' $exefile
|
||||
ls -sh $exefile
|
||||
done
|
||||
fi
|
||||
|
||||
# Build the actual .zip archive based on the file tree we've built above
|
||||
cd $OPENSCADDIR
|
||||
ZIPFILE=OpenSCAD-Tests-$VERSION-x86-$ARCH.zip
|
||||
echo "Creating binary zip package for Tests:" $ZIPFILE
|
||||
rm -f ./$ZIPFILE
|
||||
|
|
|
@ -62,7 +62,7 @@ endif()
|
|||
# Part 1. Pretty Printing
|
||||
|
||||
message("running '__openscad_binpath__ --info' to generate sysinfo.txt")
|
||||
execute_process(COMMAND __wine__ __openscad_binpath__ --info OUTPUT_FILE sysinfo.txt)
|
||||
execute_process(COMMAND __openscad_binpath__ --info OUTPUT_FILE sysinfo.txt)
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS 2.8.12)
|
||||
set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__cmake_current_binary_dir__/test_pretty_print")
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# Mingw_x_testfile - convert paths in CTestTestfile.cmake so they work
|
||||
# under Windows(TM).
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# In Windows(TM) open a console, cd to the test suite as built by
|
||||
# openscad/scripts/release-common.sh tests, then run this script.
|
||||
#
|
||||
# C:
|
||||
# cd C:\temp\OpenSCAD-Tests-2012.03.40
|
||||
# C:\python27\python.exe mingw_convert_ctest.py
|
||||
# This will overwrite CTestTestfile.cmake and CTestCustom.cmake.
|
||||
# If all goes well, 'ctest' can then be run.
|
||||
#
|
||||
#
|
||||
# C:\python27\python.exe mingw_convert_ctest.py --debug
|
||||
# This will provide extra debug info
|
||||
#
|
||||
# C:\python27\python.exe mingw_convert_ctest.py --undo
|
||||
# This will restore original CTest files from backup
|
||||
|
||||
|
||||
#
|
||||
# This is a primitive version - it assumes the locations for several files,
|
||||
# including ImageMagick, Python, and several other programs.
|
||||
#
|
||||
|
||||
# Note that under 'cmake', Windows(TM) paths use / instead of \ as a
|
||||
# folder separator.
|
||||
|
||||
# mingw_cross_info.py is created during the the scripts/release-common.sh build
|
||||
# of the regression test package. it contains info regarding paths in
|
||||
# CTestTestfiles.cmake that we need to modify
|
||||
import mingw_cross_info
|
||||
|
||||
import sys,os,string
|
||||
_debug=False
|
||||
_undo=False
|
||||
def debug(*args):
|
||||
global _debug
|
||||
if _debug:
|
||||
print 'mingw_x_testfile:',
|
||||
for arg in args: print arg,
|
||||
print
|
||||
|
||||
thisfile_abspath=os.path.abspath(__file__)
|
||||
|
||||
linbase=mingw_cross_info.linux_abs_basedir
|
||||
winbase=os.path.dirname(os.path.dirname(thisfile_abspath))
|
||||
|
||||
linbuild=mingw_cross_info.linux_abs_builddir
|
||||
winbuild=winbase+'/'+mingw_cross_info.bindir
|
||||
|
||||
lintct=linbase+'/tests/test_cmdline_tool.py'
|
||||
wintct=winbase+'/tests/test_cmdline_tool.py'
|
||||
|
||||
linpy=mingw_cross_info.linux_python #'/usr/bin/python'
|
||||
winpy='c:/python27/python.exe'
|
||||
|
||||
linosng=linbuild+'/openscad_nogui.exe'
|
||||
winosng=winbuild+'/openscad_nogui.exe'
|
||||
|
||||
linconv=mingw_cross_info.linux_convert #'/usr/bin/convert'
|
||||
# Find imagemagick's convert.exe
|
||||
list64=[]
|
||||
list32=[]
|
||||
imbase=''
|
||||
for basedir in 'C:/Program Files','C:/Program Files (x86)':
|
||||
if os.path.isdir(basedir):
|
||||
pflist=os.listdir(basedir)
|
||||
for subdir in pflist:
|
||||
if 'ImageMagick' in subdir:
|
||||
imbase = basedir+'/'+subdir
|
||||
winconv=imbase+'/convert.exe'
|
||||
if not os.path.isfile(winconv):
|
||||
print 'error, cant find convert.exe'
|
||||
|
||||
linoslib='OPENSCADPATH='+linbase+'/tests/../libraries'
|
||||
winoslib='OPENSCADPATH='+winbase+'/tests/../libraries'
|
||||
|
||||
lintestdata=linbase+'/tests/../testdata'
|
||||
wintestdata=winbase+'/tests/../testdata'
|
||||
|
||||
linexamples=linbase+'/tests/../examples'
|
||||
winexamples=winbase+'/tests/../examples'
|
||||
|
||||
if '--debug' in string.join(sys.argv): _debug=True
|
||||
if '--undo' in string.join(sys.argv): _undo=True
|
||||
|
||||
def processfile(infilename):
|
||||
backup_filename = infilename+'.backup'
|
||||
if _undo:
|
||||
open(infilename,'wb').write(open(backup_filename,'rb').read())
|
||||
print 'restored ',infilename,'from backup'
|
||||
return
|
||||
open(backup_filename,'wb').write(open(infilename,'rb').read())
|
||||
debug ('wrote backup of ',infilename,' to ',backup_filename)
|
||||
|
||||
outfilename = infilename.replace('.cmake','.win.cmake')
|
||||
fin=open(infilename,'rb')
|
||||
lines=fin.readlines()
|
||||
fout=open(outfilename,'wb')
|
||||
fout.write('#'+os.linesep)
|
||||
fout.write('# modified by mingw_x_testfile.py'+os.linesep)
|
||||
fout.write('#'+os.linesep)
|
||||
|
||||
debug('inputname',infilename)
|
||||
debug('outputname',outfilename)
|
||||
|
||||
for line in lines:
|
||||
debug('input:',line)
|
||||
|
||||
line=line.replace(lintct,wintct)
|
||||
line=line.replace(linpy,winpy)
|
||||
line=line.replace(linosng,winosng)
|
||||
line=line.replace(linconv,winconv)
|
||||
line=line.replace(linoslib,winoslib)
|
||||
line=line.replace(lintestdata,wintestdata)
|
||||
line=line.replace(linexamples,winexamples)
|
||||
|
||||
line=line.replace(linbase,winbase)
|
||||
line=line.replace('\\','/')
|
||||
|
||||
# Fixme - how do we escape spaces in cmake?
|
||||
line=line.replace('Program Files','Progra~1')
|
||||
|
||||
debug('output:',line)
|
||||
|
||||
fout.write(line)
|
||||
|
||||
print 'backed up',infilename, 'to', backup_filename
|
||||
print 'processed',infilename, 'to', outfilename
|
||||
fin.close()
|
||||
fout.close()
|
||||
open(infilename,'wb').write(open(outfilename,'rb').read())
|
||||
print 'new version of',infilename,'written'
|
||||
|
||||
processfile('CTestTestfile.cmake')
|
||||
processfile('CTestCustom.cmake')
|
||||
|
Loading…
Reference in New Issue