first stage of moving towards cross-build of test suite for mingw

master
Don Bright 2014-03-28 16:02:45 -05:00
parent 590711aa26
commit 563583ef4b
5 changed files with 117 additions and 83 deletions

View File

@ -89,9 +89,13 @@ Follow the instructions for the platform you're compiling on below.
* [Qt4 (4.4 - 4.8)](http://www.qt.nokia.com/)
* [CGAL (3.6 - 4.1)](http://www.cgal.org/)
* [GMP (5.x)](http://www.gmplib.org/)
<<<<<<< HEAD
=======
* [cmake (2.8.5, required by CGAL and the test framework)](http://www.cmake.org/)
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e
* [MPFR (3.x)](http://www.mpfr.org/)
* [boost (1.35 - 1.53)](http://www.boost.org/)
* [cmake (2.8, required by CGAL and the test framework)](http://www.cmake.org/)
* [boost (1.35 - 1.55)](http://www.boost.org/)
* [OpenCSG (1.3.2)](http://www.opencsg.org/)
* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/)
* [Eigen (3.0 - 3.2)](http://eigen.tuxfamily.org/)

View File

@ -1,25 +1,57 @@
Running regression tests:
-------------------------
Prerequisites: cmake, python, ImageMagick 6.5.9.3 or newer
First, install the prerequisite helper programs on your system:
<<<<<<< HEAD
cmake, python, ImageMagick 6.5.9.3 or newer, diff
There are binary installer packages of these tools available for Mac,
Win, Linux, BSD, and other systems. (except maybe diff for Win)
Next, get a working qmake GUI build of the main openscad binary working.
For Windows(TM) it is easiest to get a cross-build working. See
README.md for how to do this. Lastly, install MCAD under
openscad/libraries.
=======
First, install MCAD.
$ cd openscad
$ git submodule update --init
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e
A) Building test environment
Linux, Mac:
$ cd tests
$ cmake .
$ make
<<<<<<< HEAD
$ cd tests
$ cmake .
$ make
Windows(TM):
The Windows tests are cross-compiled from within linux, like so:
$ source ./scripts/setenv-mingw-xbuild.sh 64 # (32 for 32-bit system)
$ ./scripts/release-common.sh mingw64 tests # (mingw32 for 32-bit)
Once the package is built, install it into Windows as you would any
other program. Then start up a command prompt, and run this:
cd c:\Program Files\OpenSCAD_Tests\openscad\tests\bin
c:\python27\python.exe mingw_x_testfile.py
=======
Windows + MSVC:
The MSVC build hasn't been tested in years. See the README for pointers.
First, gett the main GUI to build. Then, to build the tests:
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e
This will modify paths in CTestTestfile.cmake for your Win system.
Windows + MSVC:
(This hasn't been tested since circa 2012)
From the QT command prompt:
> cd tests
@ -28,11 +60,14 @@ From the QT command prompt:
> cmake .
> nmake -f Makefile
<<<<<<< HEAD
=======
Cross compiling Linux->Win32 and testing under Wine:
Experimental. Please see openscad/tests/CMingw-cross-env.cmake for instructions
on attempting to get it to work.
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e
B) Running tests
$ ctest Runs tests enabled by default
@ -130,7 +165,7 @@ Imagemagick may have crashed while comparing the expected images to the
test-run generated (actual) images. You can try using the alternate
ImageMagick comparison method by by erasing CMakeCache, and re-running
cmake with -DCOMPARATOR=ncc. This will enable the Normalized Cross
Comparison method.
Comparison method which is less accurate but won't usually crash.
4. Testing images fails with 'morphology not found" for ImageMagick in the log
@ -142,10 +177,13 @@ cmake. The comparison will be of lowered reliability.
"terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid"
Is a boost/libstdc++ bug. Fix like so:
Is a boost/libstdc++ bug. Fix like so before running:
$ export LC_MESSAGES=
<<<<<<< HEAD
6. Proprietary GL driver issues
=======
6. I want to build without OpenGL
There is an unsupported way to do this, by defining NULLGL to Cmake:
@ -158,12 +196,25 @@ Is a boost/libstdc++ bug. Fix like so:
This option may break in the future and require tweaking to get working again.
7. Other issues
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e
The OpenSCAD User Manual has a section on buildling. Please check there
for updates:
There are sporadic reports of problems running on remote machines with
proprietary GL drivers. Try doing a web search for your exact error
message to see solutions others have found.
7. Other issues
The OpenSCAD User Manual Wiki has a section on buildling. Please check
there for possible updates and workarounds:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual
<<<<<<< HEAD
Please report build errors (after double checking the instructions) in
the github issue tracker
http://github.com/openscad/openscad/issues
=======
Migration away from dedicated regression tests:
@ -184,4 +235,5 @@ These look like tests, but are not actually in use:
* modulecachetest
* cgalcachetest
>>>>>>> 0d9b20dc143b2acca68496d2ce5e4fd02798289e

View File

@ -784,16 +784,12 @@ function(add_cmdline_test TESTCMD_BASENAME)
set(CONFARG CONFIGURATIONS)
set(CONFVAL ${FOUNDCONFIGS})
if (MINGW_CROSS_ENV_DIR)
set( MINGW_CROSS_ARG "--mingw-cross-env" )
endif()
# The python script cannot extract the testname when given extra parameters
if (TESTCMD_ARGS)
set(FILENAME_OPTION -f ${FILE_BASENAME})
endif()
add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py ${MINGW_CROSS_ARG} --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTCMD_SUFFIX} ${EXTRA_OPTIONS} ${TESTNAME_OPTION} ${FILENAME_OPTION} ${TESTCMD_EXE} "${SCADFILE}" ${TESTCMD_ARGS})
add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTCMD_SUFFIX} ${EXTRA_OPTIONS} ${TESTNAME_OPTION} ${FILENAME_OPTION} ${TESTCMD_EXE} "${SCADFILE}" ${TESTCMD_ARGS})
set_property(TEST ${TEST_FULLNAME} PROPERTY ENVIRONMENT "${CTEST_ENVIRONMENT}")
endif()
endforeach()
@ -955,10 +951,10 @@ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py PYSRC)
set_target_properties(test_pretty_print PROPERTIES COMPILE_FLAGS
"-DPYBIN=${PYTHON_EXECUTABLE} -DPYSRC=${PYSRC} -DBUILDDIR=--builddir=${CMAKE_CURRENT_BINARY_DIR}"
)
if (MINGW_CROSS_ENV_DIR)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print "wine test_pretty_print.exe")
execute_process(COMMAND chmod ugo+x ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print)
endif()
#if (MINGW_CROSS_ENV_DIR)
# file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print "test_pretty_print.exe")
# execute_process(COMMAND chmod ugo+x ${CMAKE_CURRENT_BINARY_DIR}/test_pretty_print)
#endif()
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template TMP)
string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP})
@ -969,18 +965,11 @@ string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP})
string(REPLACE __openscad_binpath__ ${OPENSCAD_BINPATH} TMP ${TMP})
set(OPENSCAD_UPLOAD_TESTS $ENV{OPENSCAD_UPLOAD_TESTS})
set(UPLOADARG "")
if (OPENSCAD_UPLOAD_TESTS)
set(UPLOADARG "--upload")
endif()
if (UPLOADARG)
string(REPLACE __openscad_upload_tests__ ${UPLOADARG} TMP ${TMP})
endif()
if (MINGW_CROSS_ENV_DIR)
string(REPLACE __wine__ wine TMP ${TMP})
else()
string(REPLACE __wine__ " " TMP ${TMP})
endif()
string(REPLACE __openscad_upload_tests__ "${UPLOADARG}" TMP ${TMP})
message(STATUS "creating CTestCustom.cmake")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP})

View File

@ -1,31 +1,39 @@
#
# CMake Toolchain file for cross compiling OpenSCAD tests linux->mingw-win32
# --------------------------------------------------------------------------
#
# This will only work under linux using 'wine'. It has not been tested under
# mingw32 nor MSVC
#
# Prerequisites: mingw-cross-env, ImageMagick 6.5.9.3 or newer, wine
# This CMake Toolchain file will cross-compile the regression test
# programs for OpenSCAD, and generate a CTestTestfile.cmake
#
# The result will not be directly usable. Please see doc/testing.txt
# for complete instructions for running the regression tests under Windows(TM)
#
# Prerequisites:
#
# Please see doc/testing.txt for pre-requisites.
#
# Usage:
#
# follow the README.md to do a mingw-cross build of openscad.exe
# the setenv-mingw-xbuild.sh script will set MXEDIR
# cd openscad/tests && mkdir build-mingw32 && cd build-mingw32
# # set env variables:
# OPENSCADPATH=../../libraries # (to find MCAD for some tests)
# cmake .. -DCMAKE_TOOLCHAIN_FILE=../CMingw-cross-env.cmake \
# -DMINGW_CROSS_ENV_DIR=$MXEDIR
# make # (should proceed as normal.)
# now run 'ctest' on your *nix machine.
# The test .exe programs should run under wine
# imagemagick's "convert" comparer will be your actual linux version.
# The pretty printer won't automatically work after the tests. You have to run
# it manually by typing 'wine test_pretty_print.exe'
# Please see doc/testing.txt for usage
#
# to debug finding MCAD with OPENSCADPATH, try something like this:
# Please do not use this file directly unless you are experimenting.
# This file is typically called from release-common.sh automatically,
# not used directly by a human.
#
# Assuming you want to build 64bit:
#
# strace -f ctest -R dumptest.*use 2>&1 | grep servos.scad
# cd openscad
# source scripts/setenv-mingw-xbuild.sh 64
# cd openscad/tests && mkdir build-mingw64 && cd build-mingw64
# export OPENSCADPATH=../../libraries # (to find MCAD for some tests)
# cmake .. -DCMAKE_TOOLCHAIN_FILE=../CMingw-cross-env.cmake \
# -DMINGW_CROSS_ENV_DIR=$MXEDIR \
# -DMACHINE=x86_64-w64-mingw32
#
# For 32 bit, change '64' to '32' in setenv/mkdir and use this machine:
# -DMACHINE=i686-pc-mingw32
#
# make # (should proceed as normal.)
#
# See also:
#
@ -41,7 +49,7 @@
# Makefile.Release generated by qmake
# cmake's FindQt4.cmake & Qt4ConfigDependentSettings.cmake files
# mingw-cross-env's qmake.conf and *.prl files
# mingw-cross-env's pkg-config files in usr/i686-pc-mingw32/lib/pkgconfig
# mingw-cross-env's pkg-config files in usr/${MACHINE}/lib/pkgconfig
# (may have to add to env var PKG_CONFIG_PATH to find qt .pc files)
# http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries
#
@ -54,45 +62,34 @@
# This file is actually called multiple times by cmake, so various 'if NOT set'
# guards are used to keep programs from running twice.
#
# The test will not currently run under win32 because the ctest harness
# is created by cmake on the machine that it is called on, not on the
# machine it is targeting.
#
#
# Part 1. Find *nix-ImageMagick
#
# The tests run under Wine under *nix. Therefore we need to find the
# ImageMagick comparison program on the *nix machine. It must be
# searched before the 'cross-compile' environment is setup.
# Part 1: Skip imagemagick search.
#
if (NOT imagemagick_cross_set)
find_package(ImageMagick COMPONENTS convert REQUIRED)
message(STATUS "ImageMagick convert executable found: " ${ImageMagick_convert_EXECUTABLE})
set( SKIP_IMAGEMAGICK TRUE )
set( imagemagick_cross_set )
endif()
set( SKIP_IMAGEMAGICK TRUE )
#
# Part 2. cross-compiler setup
#
message(STATUS "Machine: ${MACHINE}")
set(MINGW_CROSS_ENV_DIR $ENV{MINGW_CROSS_ENV_DIR})
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_SYSTEM_NAME Windows)
set(MSYS 1)
set(CMAKE_FIND_ROOT_PATH ${MINGW_CROSS_ENV_DIR}/usr/i686-pc-mingw32)
set(CMAKE_FIND_ROOT_PATH ${MINGW_CROSS_ENV_DIR}/usr/${MACHINE})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_C_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-gcc)
set(CMAKE_CXX_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-g++)
set(CMAKE_RC_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-windres)
set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-qmake)
set(PKG_CONFIG_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-pkg-config)
set(CMAKE_C_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-gcc)
set(CMAKE_CXX_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-g++)
set(CMAKE_RC_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-windres)
set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-qmake)
set(PKG_CONFIG_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-pkg-config)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
#
@ -118,14 +115,14 @@ set( GLEW_DIR ${CMAKE_FIND_ROOT_PATH} )
# end of QT_LIBRARIES
#
set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-qmake)
set(QT_MOC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-moc)
set(QT_UIC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-uic)
set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-qmake)
set(QT_MOC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-moc)
set(QT_UIC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/${MACHINE}-uic)
function(mingw_cross_env_find_qt)
# called from CMakeLists.txt
set(PKGC_DEST ${MINGW_CROSS_ENV_DIR}/usr/i686-pc-mingw32/lib/pkgconfig)
set(QT_PKGC_SRC ${MINGW_CROSS_ENV_DIR}/usr/i686-pc-mingw32/qt/lib/pkgconfig/)
set(PKGC_DEST ${MINGW_CROSS_ENV_DIR}/usr/${MACHINE}/lib/pkgconfig)
set(QT_PKGC_SRC ${MINGW_CROSS_ENV_DIR}/usr/${MACHINE}/qt/lib/pkgconfig/)
file(COPY ${QT_PKGC_SRC} DESTINATION ${PKGC_DEST} FILES_MATCHING PATTERN "*.pc")
find_package( PkgConfig )

View File

@ -154,12 +154,7 @@ def run_test(testname, cmd, args):
outfile = open(outputname, "wb")
try:
if os.path.isfile(cmd+'.exe') and options.mingw_cross_env:
cmdline = ['wine']+[cmd+'.exe'] + args + [outputname]
elif cmd[-4:].lower() == '.exe' and options.mingw_cross_env:
cmdline = ['wine']+[cmd] + args + [outputname]
else:
cmdline = [cmd] + args + [outputname]
cmdline = [cmd] + args + [outputname]
print cmdline
proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
errtext = proc.communicate()[1]
@ -192,12 +187,11 @@ def usage():
print >> sys.stderr, " -t, --test=<name> Specify test name instead of deducting it from the argument (defaults to basename <exe>)"
print >> sys.stderr, " -f, --file=<name> Specify test file instead of deducting it from the argument (default to basename <first arg>)"
print >> sys.stderr, " -c, --convexec=<name> Path to ImageMagick 'convert' executable"
print >> sys.stderr, " -x, --mingw-cross-env Mingw-cross-env cross compilation"
if __name__ == '__main__':
# Handle command-line arguments
try:
opts, args = getopt.getopt(sys.argv[1:], "gs:e:c:t:f:m:x", ["generate", "convexec=", "suffix=", "expected_dir=", "test=", "file=", "comparator=", "mingw-cross-env"])
opts, args = getopt.getopt(sys.argv[1:], "gs:e:c:t:f:m:x", ["generate", "convexec=", "suffix=", "expected_dir=", "test=", "file=", "comparator="])
except getopt.GetoptError, err:
usage()
sys.exit(2)
@ -224,8 +218,6 @@ if __name__ == '__main__':
options.convert_exec = os.path.normpath( a )
elif o in ("-m", "--comparator"):
options.comparator = a
elif o in ("-x", "--mingw-cross-env"):
options.mingw_cross_env = True
# <cmdline-tool> and <argument>
if len(args) < 2: