Compare commits

...

41 commits

Author SHA1 Message Date
Don Bright
6ad688ae34 Merge branch 'unstable' of github.com:openscad/openscad into win_test_fixes 2014-04-22 22:52:27 -05:00
don bright
762a94fbed yet another cmake version detection fix 2014-04-18 22:02:28 -07:00
don bright
1950e963bf improve cmake version detection and build warning 2014-04-19 06:44:39 +02:00
don bright
b0505b2663 Merge branch 'win_test_fixes' of github.com:openscad/openscad into win_test_fixes 2014-04-19 06:07:17 +02:00
don bright
46ece81582 Merge branch 'delete_me' of github.com:openscad/openscad into win_test_fixes 2014-04-19 06:05:59 +02:00
don bright
3f56dbe043 enable build on QT less than 4.7 (debian 6) by modifying setplaceholderText calls
(setplaceholderText was introduced as part of the find/replace feature)
2014-04-19 06:03:35 +02:00
don bright
a1bdba0c7b fix build under gcc 4.4.5 by making initializer more specific 2014-04-19 05:15:56 +02:00
don bright
efc2ee6990 fix ftp mirror bug in fetch script. set PKG_CONFIG_PATH properly 2014-04-19 05:04:21 +02:00
don bright
369e3426dc add transform-nan-inf results properly 2014-04-18 19:52:28 -07:00
don bright
5e90dbad48 update build script to use GNU ftp mirrors for mpfr and gmplib. fix gmp finder 2014-04-19 04:46:12 +02:00
Don Bright
6f558cc030 cleanup for pull request, better documentation 2014-04-18 21:01:00 -05:00
Don Bright
7229941927 cleanup for pull request - part 1. includes crlf->lf fixes 2014-04-18 20:54:24 -05:00
Don Bright
b0f7d7c3f7 Merge branch 'unstable' of github.com:openscad/openscad into unstable 2014-04-18 20:27:09 -05:00
Don Bright
a899179822 explain that you have to extract the .zip file for it to work 2014-04-18 20:25:23 -05:00
Don Bright
c8bfc4db61 make debuglog always have output under windows(TM) 2014-04-18 20:20:04 -05:00
Don Bright
1c7f3f8962 we now use 'difflib' from python under win(TM), remove warning. 2014-04-18 20:13:43 -05:00
Don Bright
2ce04e40f9 use full canonical pathname for saved html report file 2014-04-18 20:12:00 -05:00
Don Bright
b7cbe6297c better ctest description for windows(TM) users of tests 2014-04-18 20:05:14 -05:00
Don Bright
2c073551e8 use modified atan2 under win32 to match other archs/systems. use better dir name
for windows(TM) test builds
2014-04-18 20:02:37 -05:00
Don Bright
2134213638 dont render faces with NaN/Infinity points in f5 Preview on win64.
fix several windows Tests, improve release-common fail response.
2014-04-18 19:23:13 -05:00
Don Bright
02ae72faa5 add infinity test to dumptests. add new results 2014-04-16 21:35:47 -05:00
Don Bright
db8e3902d1 add infinite translation tests to echotest. 2014-04-16 21:30:42 -05:00
Don Bright
1793c677e4 crossbuild tests/bin exclusion (assume build of linux binaries may live here) 2014-04-16 20:52:47 -05:00
Don Bright
83892a6fc8 new results for infinity tests (baseline, x86_64 linux) 2014-04-16 20:19:37 -05:00
Don Bright
df732bd5b7 add more tests to infinity tester.
also improve windows func name in cross_console
2014-04-16 20:16:20 -05:00
Don Bright
3421e2d484 add -0 -0 to inf test. remove fout bug in console 2014-04-14 20:42:20 -05:00
Don Bright
013cda994e adding many more tests for atan2 due to portability issues. debugging as well 2014-04-14 19:34:48 -05:00
Don Bright
f3b830ce65 new test results for more description output for inf echo tests 2014-04-13 20:14:24 -05:00
Don Bright
2edd9b8891 better output of inf-tests. prevent seg fault if no geometry (stl output) 2014-04-13 20:09:54 -05:00
Don Bright
6916311148 move cgalstlsanitytest to test_cmdline_tool so it will work on Windows(TM) 2014-04-13 18:45:44 -05:00
Don Bright
482f79627c primitive dump() using Value() to allow tests to pass on Win. Regen dumptests 2014-04-13 16:32:06 -05:00
Don Bright
17e7f51ef5 fixup path separator under windows(TM), use difflib per MichaelAtOz suggestion
(windows(TM) does not have 'diff', or at least Wine doesnt)
2014-04-13 13:55:23 -05:00
Don Bright
e831d98574 translate the paths in the templated scad files 2014-04-13 12:17:24 -05:00
Don Bright
409f5851b7 better unicode support, also use PATH to find binaries 2014-04-13 10:47:44 -05:00
Don Bright
cdb78a6f3c fix crlf lf conversion. more debugging info 2014-04-12 12:16:45 -05:00
Don Bright
06206d3e2d fix UnicodeDecodingError on Win7, add debug msgs 2014-04-12 11:31:23 -05:00
Don Bright
da8289bb42 fix bug where flags werent adding to test report 2014-04-11 21:44:39 -05:00
Don Bright
964b337146 bring revamped scripts to basic working state 2014-04-11 21:26:56 -05:00
Don Bright
af9dd06d77 rearrance win test build to recent changes improving portability 2014-04-11 14:29:26 -05:00
Don Bright
5b1e203058 move cross_info generation from release_common.sh to cmake template build 2014-04-11 13:48:01 -05:00
Don Bright
66adbfd35f rework windows ctest setup to be more portable. rename. 2014-04-11 13:47:05 -05:00
38 changed files with 1685 additions and 667 deletions

View file

@ -191,6 +191,15 @@ FORMS += src/MainWindow.ui \
src/AboutDialog.ui \ src/AboutDialog.ui \
src/ProgressWidget.ui src/ProgressWidget.ui
lessThan(QT_MAJOR_VERSION, 5) {
lessThan(QT_MINOR_VERSION, 7) {
message("System has QT < 4.7, disabling setplaceholderText in MainWindow")
system("sed s/placeholderText/Text/g src/MainWindow.ui > src/MainWindowOldQT.ui")
FORMS -= src/MainWindow.ui
FORMS += src/MainWindowOldQT.ui
}
}
HEADERS += src/typedefs.h \ HEADERS += src/typedefs.h \
src/version_check.h \ src/version_check.h \
src/ProgressWidget.h \ src/ProgressWidget.h \

View file

@ -112,7 +112,7 @@ mpfr_sysver()
gmp_sysver() gmp_sysver()
{ {
gmppaths="`find $1 -name 'gmp.h' -o -name 'gmp-*.h'`" gmppaths="`find $1/include -name 'gmp.h' -o -name 'gmp-*.h'`"
if [ ! "$gmppaths" ]; then if [ ! "$gmppaths" ]; then
debug "gmp_sysver no gmp.h beneath $1" debug "gmp_sysver no gmp.h beneath $1"
return return

View file

@ -20,22 +20,19 @@
# If no make target is given, release will be used on Windows, none one Mac OS X # If no make target is given, release will be used on Windows, none one Mac OS X
# #
# The mingw cross compile depends on the MXE cross-build tools. Please # The mingw cross compile depends on the MXE cross-build tools. Please
# see the README.md file on how to install these dependencies. To debug # see the README.md file on how to install these dependencies.
# the mingw-cross build process, set env var FAKEMAKE=1 to fake-make the
# .exe files
# #
# Setting the environment variables FAKEMAKE=1 and FAKEMAKETESTS=1 will
# quickly build 'fake' .exe files which can help while debugging this script.
# convert end-of-line in given file from unix \n to dos/windows(TM) \r\n # convert end-of-line in given file from unix \n to dos/windows(TM) \r\n
# see https://kb.iu.edu/data/acux.html # see https://kb.iu.edu/data/acux.html
lf2crlf() lf2crlf()
{ {
fname=$1 fname=$1
if [ "`command -v unix2dos`" ]; then
unix2dos $fname
return
fi
if [ "`command -v awk`" ]; then if [ "`command -v awk`" ]; then
echo using awk to convert end of line markers in $fname # echo using awk to convert end of line markers in $fname
awk 'sub("$", "\r")' $fname > $fname".temp" awk 'sub("$", "\r")' $fname > $fname".temp"
mv $fname".temp" $fname mv $fname".temp" $fname
return return
@ -242,6 +239,10 @@ case $OS in
else else
make $TARGET -j$NUMCPU make $TARGET -j$NUMCPU
fi fi
if [ $? -ne 0 ]; then
echo "error during make. exiting"
exit
fi
if [ ! -e $TARGET/openscad.exe ]; then if [ ! -e $TARGET/openscad.exe ]; then
echo "cant find $TARGET/openscad.exe. build failed. stopping." echo "cant find $TARGET/openscad.exe. build failed. stopping."
exit exit
@ -249,6 +250,10 @@ case $OS in
# make console pipe-able openscad.com - see winconsole.pri for info # make console pipe-able openscad.com - see winconsole.pri for info
qmake CONFIG+=winconsole ../openscad.pro qmake CONFIG+=winconsole ../openscad.pro
make make
if [ $? -ne 0 ]; then
echo "error during make. exiting"
exit
fi
if [ ! -e $TARGET/openscad.com ]; then if [ ! -e $TARGET/openscad.com ]; then
echo "cant find $TARGET/openscad.com. build failed. stopping." echo "cant find $TARGET/openscad.com. build failed. stopping."
exit exit
@ -278,27 +283,34 @@ echo "Building test suite..."
if [ $BUILD_TESTS ]; then if [ $BUILD_TESTS ]; then
case $OS in case $OS in
UNIX_CROSS_WIN) UNIX_CROSS_WIN)
# Note - we avoid relative paths in here.
TESTBUILD_MACHINE=x86_64-w64-mingw32 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=tests-build
export TESTBUILD_MACHINE
export TESTBINDIR
if [[ $ARCH == 32 ]]; then if [[ $ARCH == 32 ]]; then
TESTBUILD_MACHINE=i686-pc-mingw32 TESTBUILD_MACHINE=i686-pc-mingw32
fi fi
cd $DEPLOYDIR export TESTBUILD_MACHINE
mkdir $TESTBINDIR # dont use build-machine triple in TESTBINDIR because the 'mingw32'
cd $TESTBINDIR # at the end of the name will confuse people who are on 64 bit machines
TESTBINDIR=testbin
TESTBINABSDIR=$DEPLOYDIR/$TESTBINDIR
export TESTBINDIR
export TESTBINABSDIR
mkdir $TESTBINABSDIR
cd $TESTBINABSDIR
cmake $OPENSCADDIR/tests/ \ cmake $OPENSCADDIR/tests/ \
-DCMAKE_TOOLCHAIN_FILE=../tests/CMingw-cross-env.cmake \ -DCMAKE_TOOLCHAIN_FILE=$OPENSCADDIR/tests/CMingw-cross-env.cmake \
-DMINGW_CROSS_ENV_DIR=$MXEDIR \ -DMINGW_CROSS_ENV_DIR=$MXEDIR \
-DMACHINE=$TESTBUILD_MACHINE -DMACHINE=$TESTBUILD_MACHINE
if [ $FAKEMAKE ]; then if [ $FAKEMAKETESTS ]; then
echo "notexe. debugging build process" > openscad_nogui.exe echo "notexe. debugging build process" > openscad_nogui.exe
else else
make -j$NUMCPU make -j$NUMCPU
fi fi
if [ $? -ne 0 ]; then
echo "error during make. exiting"
exit
fi
if [ ! -e openscad_nogui.exe ]; then if [ ! -e openscad_nogui.exe ]; then
echo 'test cross-build failed' echo 'test cross-build failed'
exit 1 exit 1
@ -311,6 +323,7 @@ if [ $BUILD_TESTS ]; then
esac esac
fi # BUILD_TESTS fi # BUILD_TESTS
echo "Creating directory structure..." echo "Creating directory structure..."
case $OS in case $OS in
@ -352,7 +365,7 @@ if [ -n $LIBRARYDIR ]; then
chmod -R u=rwx,go=r,+X $LIBRARYDIR/* chmod -R u=rwx,go=r,+X $LIBRARYDIR/*
fi fi
echo "Creating archive.." echo "Creating GUI archive.."
case $OS in case $OS in
MACOSX) MACOSX)
@ -451,96 +464,99 @@ if [ $BUILD_TESTS ]; then
echo "Creating regression tests package..." echo "Creating regression tests package..."
case $OS in case $OS in
MACOSX) MACOSX)
echo 'building regression test package on OSX not implemented' echo 'regression test package on OSX not implemented'
;; ;;
WIN) WIN)
echo 'building regression test package on Win not implemented' echo 'regression test package under Win not implemented'
;; ;;
UNIX_CROSS_WIN) UNIX_CROSS_WIN)
# Build a .zip file containing all the files we need to run a # 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 # ctest on Windows(TM). For the sake of simplicity, we do not
# create an installer for the tests. # create an installer for the tests.
#
# $PACKDIR is the folder where we build-up the file tree that will
# appear when the user opens the .zip package on a Windows(TM) machine
PACKDIR=OpenSCAD-Tests-$VERSION-x86-$ARCH
echo "Copying files..." echo -n "Copying folders: "
cd $OPENSCADDIR cd $OPENSCADDIR
# This copies a lot of unnecessary stuff but that's OK. # This copies a lot of unnecessary stuff but that's OK.
# as above, we use tar as a somewhat portable way to do 'exclude' # as above, we use tar as a somewhat portable alternative to
# while copying. # 'cp', as we can easily do 'exclude'.
rm -f ./ostests.tar TARFILE=$OPENSCADDIR/ostests.tar
for subdir in tests testdata libraries examples doc; do rm -f $TARFILE
tar prvf ./ostests.tar --exclude=.git* --exclude=*/mingw64/* --exclude=*/mingw32/* --exclude=*.cc.obj --exclude=*.a $subdir TARXCLUDE='--exclude=.git* --exclude=*.a --exclude=*.obj --exclude=tests/bin* --exclude=CMakeCache*'
TARCMD='tar prf '$TARFILE' '$TARXCLUDE
for subdir in testdata libraries examples doc; do
echo -n $subdir' '
#echo $TARCMD $subdir
$TARCMD $subdir
if [ $? -ne 0 ]; then echo tar error && exit 1; fi
done done
cd $DEPLOYDIR #echo $TARCMD tests
tar prvf $OPENSCADDIR/ostests.tar --exclude=.git* --exclude=*/mingw* --exclude=*.cc.obj --exclude=*.a $TESTBINDIR echo -n tests' '
$TARCMD tests
if [ $? -ne 0 ]; then echo tar error && exit 1; fi
cd $TESTBINABSDIR/..
#echo $TARCMD $TESTBINDIR
echo -n $TESTBINDIR' '
$TARCMD $TESTBINDIR
if [ $? -ne 0 ]; then echo tar error && exit 1; fi
echo
cd $DEPLOYDIR cd $DEPLOYDIR
if [ -e ./OpenSCAD-Tests-$VERSION ]; then if [ -e ./$PACKDIR ]; then
rm -rf ./OpenSCAD-Tests-$VERSION rm -rf ./$PACKDIR
fi fi
mkdir OpenSCAD-Tests-$VERSION mkdir ./$PACKDIR
cd OpenSCAD-Tests-$VERSION cd ./$PACKDIR
tar pxf $OPENSCADDIR/ostests.tar tar pxf $OPENSCADDIR/ostests.tar
rm -f $OPENSCADDIR/ostests.tar #rm -f $OPENSCADDIR/ostests.tar
# Now we have the basic files copied into our tree that will become # 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 # our .zip file. We also want to move some files around for easier
# access for the user: # access for the user:
cd $DEPLOYDIR cd $DEPLOYDIR
cd ./OpenSCAD-Tests-$VERSION cd ./$PACKDIR
echo "Copying files for ease of use when running from cmdline" #echo "Copying files for ease of use when running from cmdline"
cp -v ./tests/OpenSCAD_Test_Console.py . cp -v ./tests/CTest_Cross_Console.py .
cp -v ./tests/WinReadme.txt . cp -v ./tests/WinReadme.txt .
cp -v ./tests/mingw_convert_ctest.py ./$TESTBINDIR cp -v ./tests/mingwcon.bat ./$TESTBINDIR/
cp -v ./tests/mingwcon.bat ./$TESTBINDIR
echo "Creating mingw_cross_info.py file"
cd $DEPLOYDIR cd $DEPLOYDIR
cd ./OpenSCAD-Tests-$VERSION cd ./$PACKDIR
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='"$DEPLOYDIR/$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
# note- this has to match the CMakeLists.txt line that sets the
# convert executable... and CMingw-cross-env.cmake's skip-imagemagick
# setting. what a kludge!
echo "linux_convert='/bin/echo'" >> mingw_cross_info.py
echo "win_installdir='OpenSCAD_Tests_"$VERSIONDATE"'" >> mingw_cross_info.py
echo 'Converting linefeed to carriage-return+linefeed' echo -n 'Converting linefeed to carriage-return+linefeed '
for textfile in `find . | grep txt$`; do lf2crlf $textfile; done for extension in txt py cmake bat; do
for textfile in `find . | grep py$`; do lf2crlf $textfile; done echo -n '*.'$extension' '
for textfile in `find . | grep cmake$`; do lf2crlf $textfile; done for textfile in `find . | grep $extension'$'`; do
for textfile in `find . | grep bat$`; do lf2crlf $textfile; done lf2crlf $textfile
done
done
echo
# Test binaries can be hundreds of megabytes due to debugging info. # Test binaries can be hundreds of megabytes due to debugging info.
# By default, we strip that. In most cases we wont need it and it # By default, we strip that. In most cases we wont need it and it
# causes too many problems to have >100MB files. # causes too many problems to have >100MB files.
echo "stripping .exe binaries" echo "stripping .exe binaries"
cd $DEPLOYDIR cd $TESTBINABSDIR
cd ./OpenSCAD-Tests-$VERSION
cd $TESTBINDIR
if [ "`command -v $TESTBUILD_MACHINE'-strip' `" ]; then if [ "`command -v $TESTBUILD_MACHINE'-strip' `" ]; then
for exefile in *exe; do for exefile in *exe; do
ls -sh $exefile BEFORESIZE=`ls -s $exefile`
echo $TESTBUILD_MACHINE'-strip' $exefile
$TESTBUILD_MACHINE'-strip' $exefile $TESTBUILD_MACHINE'-strip' $exefile
ls -sh $exefile AFTERSIZE=`ls -s $exefile`
echo $TESTBUILD_MACHINE'-strip' $BEFORESIZE '->' $AFTERSIZE
done done
else
echo $TESTBUILD_MACHINE'-strip' not found
fi fi
# Build the actual .zip archive based on the file tree we've built above # Build the actual .zip archive based on the file tree we've built above
cd $DEPLOYDIR cd $DEPLOYDIR
ZIPFILE=OpenSCAD-Tests-$VERSION-x86-$ARCH.zip ZIPFILE=$PACKDIR'.zip'
echo "Creating binary zip package for Tests:" $ZIPFILE echo "Creating binary zip package for Tests:" $ZIPFILE
rm -f ./$ZIPFILE rm -f ./$ZIPFILE
"$ZIP" $ZIPARGS $ZIPFILE OpenSCAD-Tests-$VERSION "$ZIP" $ZIPARGS $ZIPFILE $PACKDIR
if [ -e $ZIPFILE ]; then if [ -e $ZIPFILE ]; then
echo "ZIP package created:" `pwd`/$ZIPFILE echo "ZIP package created:" `pwd`/$ZIPFILE

View file

@ -19,20 +19,29 @@ setenv_common()
fi fi
DEPLOYDIR=$BASEDIR DEPLOYDIR=$BASEDIR
PATH=$BASEDIR/bin:$PATH
LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
OPENSCAD_LIBRARIES=$DEPLOYDIR
GLEWDIR=$DEPLOYDIR
PKG_CONFIG_PATH=$BASEDIR/lib/pkgconfig:$PKG_CONFIG_PATH
export BASEDIR export BASEDIR
export PATH=$BASEDIR/bin:$PATH export PATH
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 export LD_LIBRARY_PATH
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 export LD_RUN_PATH
export OPENSCAD_LIBRARIES=$DEPLOYDIR export OPENSCAD_LIBRARIES
export GLEWDIR=$DEPLOYDIR export GLEWDIR
export PKG_CONFIG_PATH
echo BASEDIR: $BASEDIR echo BASEDIR: $BASEDIR
echo DEPLOYDIR: $DEPLOYDIR echo DEPLOYDIR: $DEPLOYDIR
echo PATH modified echo PATH modified
echo LD_LIBRARY_PATH modified echo LD_LIBRARY_PATH modified
echo LD_RUN_PATH modified echo LD_RUN_PATH modified
echo OPENSCAD_LIBRARIES modified echo OPENSCAD_LIBRARIES modified: $OPENSCAD_LIBRARIES
echo GLEWDIR modified echo GLEWDIR modified
echo PKG_CONFIG_PATH modified: $PKG_CONFIG_PATH
if [ "`uname -m | grep sparc64`" ]; then if [ "`uname -m | grep sparc64`" ]; then
echo detected sparc64. forcing 32 bit with export ABI=32 echo detected sparc64. forcing 32 bit with export ABI=32

View file

@ -96,7 +96,9 @@ build_qt4()
cd $BASEDIR/src cd $BASEDIR/src
rm -rf qt-everywhere-opensource-src-$version rm -rf qt-everywhere-opensource-src-$version
if [ ! -f qt-everywhere-opensource-src-$version.tar.gz ]; then if [ ! -f qt-everywhere-opensource-src-$version.tar.gz ]; then
curl -O http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-$version.tar.gz #curl -O http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-$version.tar.gz
# curl -O http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-$version.tar.gz
curl -O http://mirror.os6.org/qtproject/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
fi fi
tar xzf qt-everywhere-opensource-src-$version.tar.gz tar xzf qt-everywhere-opensource-src-$version.tar.gz
cd qt-everywhere-opensource-src-$version cd qt-everywhere-opensource-src-$version
@ -189,7 +191,8 @@ build_gmp()
cd $BASEDIR/src cd $BASEDIR/src
rm -rf gmp-$version rm -rf gmp-$version
if [ ! -f gmp-$version.tar.bz2 ]; then if [ ! -f gmp-$version.tar.bz2 ]; then
curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 #curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2
curl --location --insecure -O http://ftpmirror.gnu.org/gmp/gmp-$version.tar.bz2
fi fi
tar xjf gmp-$version.tar.bz2 tar xjf gmp-$version.tar.bz2
cd gmp-$version cd gmp-$version
@ -211,7 +214,8 @@ build_mpfr()
cd $BASEDIR/src cd $BASEDIR/src
rm -rf mpfr-$version rm -rf mpfr-$version
if [ ! -f mpfr-$version.tar.bz2 ]; then if [ ! -f mpfr-$version.tar.bz2 ]; then
curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 #curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2
curl --location --insecure -O http://ftpmirror.gnu.org/mpfr/mpfr-$version.tar.bz2
fi fi
tar xjf mpfr-$version.tar.bz2 tar xjf mpfr-$version.tar.bz2
cd mpfr-$version cd mpfr-$version
@ -693,13 +697,22 @@ if [ ! "`command -v bison`" ]; then
build_bison 2.6.1 build_bison 2.6.1
fi fi
cmake_warn()
{
echo "cmake build finished."
echo "if OK, logout and log back in, then restart the build"
exit
}
# NB! For cmake, also update the actual download URL in the function # NB! For cmake, also update the actual download URL in the function
if [ ! "`command -v cmake`" ]; then if [ ! "`command -v cmake`" ]; then
build_cmake 2.8.8 build_cmake 2.8.8
cmake_warn
fi fi
# see README for needed version (this should match 1<minimum) # see README for needed version (this should match 1<minimum)
if [ "`cmake --version | grep 'version 2.[1-8][^0-9][1-4] '`" ]; then if [ "`cmake --version | grep 'version 2\.[1-8]\.[0-4] '`" ]; then
build_cmake 2.8.8 build_cmake 2.8.8
cmake_warn
fi fi
# Singly build certain tools or libraries # Singly build certain tools or libraries
@ -718,7 +731,7 @@ if [ $1 ]; then
fi fi
if [ $1 = "qt4" ]; then if [ $1 = "qt4" ]; then
# such a huge build, put here by itself # such a huge build, put here by itself
build_qt4 4.8.4 build_qt4 4.8.5
exit $? exit $?
fi fi
if [ $1 = "glu" ]; then if [ $1 = "glu" ]; then

View file

@ -2,7 +2,14 @@
#define MAINWINDOW_H_ #define MAINWINDOW_H_
#include <QMainWindow> #include <QMainWindow>
#include <QtCore/qglobal.h>
#if QT_VERSION < 0x040700
#include "ui_MainWindowOldQT.h"
#else
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
#endif
#include "openscad.h" #include "openscad.h"
#include "modcontext.h" #include "modcontext.h"
#include "module.h" #include "module.h"

View file

@ -1,4 +1,7 @@
#include "PlatformUtils.h" #include "PlatformUtils.h"
#include "math.h"
#include <boost/math/special_functions/fpclassify.hpp>
#include "printutils.h" #include "printutils.h"
#include <windows.h> #include <windows.h>
#ifndef _WIN32_IE #ifndef _WIN32_IE
@ -11,6 +14,34 @@ std::string PlatformUtils::pathSeparatorChar()
return ";"; return ";";
} }
double PlatformUtils::atan2( double y, double x )
{
#if defined(__MINGW32__) && !defined(__MINGW64__)
// MINGW32 atan2 on Win7x64 returns 'nan' when inputs are 'infinity'
// but this conflicts with Mingw64 behavior as well as the Open Group
// standard for infinity inputs which is used on *nix machines.
// Here we make MINGW32 conform to Open Group standard for atan2 and
// rely on our regression tests ('inf') to catch portability issues.
// Note - Untested under MSVC! (as of 2014 Apr)
double result = 0;
if ( (boost::math::isinf)(y) ) {
if ( (boost::math::isfinite)(x) ) {
result = M_PI*2.0/4.0;
} else if (x<0) { // x = -infinity
result = M_PI*3.0/4.0;
} else if (x>0) { // x = +infinity
result = M_PI*1.0/4.0;
} else {
PRINT("ERROR: x==infinity, x not <0, and x not >0");
return 0;
}
if ( y < 0 ) result *= -1;
return result;
}
#endif
return std::atan2(y,x);
}
// convert from windows api w_char strings (usually utf16) to utf8 std::string // convert from windows api w_char strings (usually utf16) to utf8 std::string
std::string winapi_wstr_to_utf8( std::wstring wstr ) std::string winapi_wstr_to_utf8( std::wstring wstr )
{ {

View file

@ -2,6 +2,7 @@
#include "PlatformUtils.h" #include "PlatformUtils.h"
#include "boosty.h" #include "boosty.h"
#include <cmath> // atan2
extern std::vector<std::string> librarypath; extern std::vector<std::string> librarypath;
@ -77,6 +78,13 @@ bool PlatformUtils::createBackupPath()
return OK; return OK;
} }
#if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(_MSC_VER)
double PlatformUtils::atan2(double y,double x)
{
return std::atan2(y,x);
}
#endif
#include "version_check.h" #include "version_check.h"
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x) #define TOSTRING(x) STRINGIFY(x)

View file

@ -11,7 +11,7 @@ namespace PlatformUtils {
std::string backupPath(); std::string backupPath();
bool createBackupPath(); bool createBackupPath();
std::string info(); std::string info();
/** /**
* Single character separating path specifications in a list * Single character separating path specifications in a list
* (e.g. OPENSCADPATH). On Windows that's ';' and on most other * (e.g. OPENSCADPATH). On Windows that's ';' and on most other
@ -20,6 +20,17 @@ namespace PlatformUtils {
* @return the path separator * @return the path separator
*/ */
std::string pathSeparatorChar(); std::string pathSeparatorChar();
/**
* quadrant-conscious arc-tangent. the platform differences come into
* play when dealing with Not-a-Number (NaN) and Infinity (inf) inputs.
* See Wikipedia, and compare Linux/Open Group atan2 vs MSVC atan2.
* We use Linux/Open Group version & test inf input in Regression Tests
* Note: Untested under MSVC! (as of 2014 Apr)
*
* @return the arctangent, in binary floating-point Radians
*/
double atan2(double y, double x);
} }
#endif #endif

View file

@ -35,6 +35,7 @@
#include "stl-utils.h" #include "stl-utils.h"
#include "printutils.h" #include "printutils.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "PlatformUtils.h"
#include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/fpclassify.hpp>
using boost::math::isnan; using boost::math::isnan;
@ -264,8 +265,15 @@ Value builtin_atan(const Context *, const EvalContext *evalctx)
Value builtin_atan2(const Context *, const EvalContext *evalctx) Value builtin_atan2(const Context *, const EvalContext *evalctx)
{ {
if (evalctx->numArgs() == 2 && evalctx->getArgValue(0).type() == Value::NUMBER && evalctx->getArgValue(1).type() == Value::NUMBER) if (evalctx->numArgs() == 2) {
return Value(rad2deg(atan2(evalctx->getArgValue(0).toDouble(), evalctx->getArgValue(1).toDouble()))); Value y = evalctx->getArgValue(0);
Value x = evalctx->getArgValue(1);
if (y.type()==Value::NUMBER && x.type()==Value::NUMBER) {
double yfp = y.toDouble();
double xfp = x.toDouble();
return Value(rad2deg(PlatformUtils::atan2(yfp,xfp)));
}
}
return Value(); return Value();
} }

View file

@ -44,9 +44,11 @@ namespace fs = boost::filesystem;
#include "unistd.h" #include "unistd.h"
#endif #endif
#if defined __WIN32__ || defined _MSC_VER #if defined __WIN32__ || defined _MSC_VER
#if !defined(__MINGW64__)
extern "C" int __cdecl _isatty(int _FileHandle); extern "C" int __cdecl _isatty(int _FileHandle);
#define isatty _isatty #define isatty _isatty
#endif #endif // MINGW64
#endif // WIN32 || _MSC_VER
std::string stringcontents; std::string stringcontents;
int lexerget_lineno(void); int lexerget_lineno(void);

View file

@ -378,6 +378,10 @@ int cmdline(const char *deps_output_file, const std::string &filename, Camera &c
} }
if (stl_output_file) { if (stl_output_file) {
if (!root_geom) {
PRINT("No top level object found");
return 1;
}
if (root_geom->getDimension() != 3) { if (root_geom->getDimension() != 3) {
PRINT("Current top level object is not a 3D object.\n"); PRINT("Current top level object is not a 3D object.\n");
return 1; return 1;

View file

@ -223,6 +223,10 @@ static void gl_draw_triangle(GLint *shaderinfo, const Vector3d &p0, const Vector
void PolySet::render_surface(Renderer::csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo) const void PolySet::render_surface(Renderer::csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo) const
{ {
if (matrix_contains_infinity(m)||matrix_contains_nan(m)) {
PRINT("WARNING: Transformation matrix contains Not-a-Number and/or Infinity - cannot draw surface");
return;
}
bool mirrored = m.matrix().determinant() < 0; bool mirrored = m.matrix().determinant() < 0;
#ifdef ENABLE_OPENCSG #ifdef ENABLE_OPENCSG
if (shaderinfo) { if (shaderinfo) {

View file

@ -621,17 +621,17 @@ std::string PrimitiveNode::toString() const
switch (this->type) { switch (this->type) {
case CUBE: case CUBE:
stream << "(size = [" << this->x << ", " << this->y << ", " << this->z << "], " stream << "(size = [" << Value(this->x) << ", " << Value(this->y) << ", " << Value(this->z) << "], "
<< "center = " << (center ? "true" : "false") << ")"; << "center = " << (center ? "true" : "false") << ")";
break; break;
case SPHERE: case SPHERE:
stream << "($fn = " << this->fn << ", $fa = " << this->fa stream << "($fn = " << this->fn << ", $fa = " << this->fa
<< ", $fs = " << this->fs << ", r = " << this->r1 << ")"; << ", $fs = " << this->fs << ", r = " << Value(this->r1) << ")";
break; break;
case CYLINDER: case CYLINDER:
stream << "($fn = " << this->fn << ", $fa = " << this->fa stream << "($fn = " << this->fn << ", $fa = " << this->fa
<< ", $fs = " << this->fs << ", h = " << this->h << ", r1 = " << this->r1 << ", $fs = " << this->fs << ", h = " << Value(this->h) << ", r1 = " << Value(this->r1)
<< ", r2 = " << this->r2 << ", center = " << (center ? "true" : "false") << ")"; << ", r2 = " << Value(this->r2) << ", center = " << (center ? "true" : "false") << ")";
break; break;
case POLYHEDRON: case POLYHEDRON:
stream << "(points = " << this->points stream << "(points = " << this->points
@ -639,12 +639,12 @@ std::string PrimitiveNode::toString() const
<< ", convexity = " << this->convexity << ")"; << ", convexity = " << this->convexity << ")";
break; break;
case SQUARE: case SQUARE:
stream << "(size = [" << this->x << ", " << this->y << "], " stream << "(size = [" << Value(this->x) << ", " << Value(this->y) << "], "
<< "center = " << (center ? "true" : "false") << ")"; << "center = " << (center ? "true" : "false") << ")";
break; break;
case CIRCLE: case CIRCLE:
stream << "($fn = " << this->fn << ", $fa = " << this->fa stream << "($fn = " << this->fn << ", $fa = " << this->fa
<< ", $fs = " << this->fs << ", r = " << this->r1 << ")"; << ", $fs = " << this->fs << ", r = " << Value(this->r1) << ")";
break; break;
case POLYGON: case POLYGON:
stream << "(points = " << this->points << ", paths = " << this->paths << ", convexity = " << this->convexity << ")"; stream << "(points = " << this->points << ", paths = " << this->paths << ", convexity = " << this->convexity << ")";

View file

@ -3,6 +3,7 @@
#include <cstring> #include <cstring>
#include "linalg.h" #include "linalg.h"
#include <sstream>
class State class State
{ {
@ -27,7 +28,16 @@ public:
const AbstractNode *parent() const { return this->parentnode; } const AbstractNode *parent() const { return this->parentnode; }
const Transform3d &matrix() const { return this->matrix_; } const Transform3d &matrix() const { return this->matrix_; }
const Color4f &color() const { return this->color_; } const Color4f &color() const { return this->color_; }
std::string dump() {
std::stringstream s;
s << "State: isPrefix: " << isPrefix();
s << " isPostfix: " << isPostfix();
s << " numChildren: " << numChildren();
s << "\nparent: " << parent();
s << " color: " << color().transpose();
s << " transform3d matrix:\n" << matrix().affine();
return s.str();
}
private: private:
const AbstractNode * parentnode; const AbstractNode * parentnode;
bool isprefix; bool isprefix;

View file

@ -5,14 +5,14 @@
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
class Assignment : public std::pair<std::string, boost::shared_ptr<class Expression> > typedef boost::shared_ptr<class Expression> ExpressionSP;
class Assignment : public std::pair<std::string, ExpressionSP >
{ {
public: public:
Assignment(std::string name) : pair(name, boost::shared_ptr<class Expression>()) {} Assignment(std::string name) : std::pair<std::string, ExpressionSP>(name, ExpressionSP()) {}
Assignment(std::string name, boost::shared_ptr<class Expression> expr) : pair(name, expr) {} Assignment(std::string name, boost::shared_ptr<class Expression> expr) : std::pair<std::string, ExpressionSP>(name, expr) {}
}; };
typedef std::vector<Assignment> AssignmentList; typedef std::vector<Assignment> AssignmentList;
typedef std::vector<class ModuleInstantiation*> ModuleInstantiationList; typedef std::vector<class ModuleInstantiation*> ModuleInstantiationList;
#endif #endif

View file

@ -1,23 +1,386 @@
echo(1/0); echo( "0", 0);
echo(-1/0); echo("-0",-0);
echo(sin(1/0));
echo(cos(1/0)); echo(" 0/ 0", 0 / 0);
echo(tan(1/0)); echo("-0/ 0",-0 / 0);
echo(asin(1/0)); echo(" 0/-0", 0 /-0);
echo(acos(1/0)); echo("-0/-0",-0 /-0);
echo(atan(1/0));
echo(atan(-1/0)); echo(" 1/ 0", 1 / 0);
echo(atan2(1/0, -1/0)); echo("-1/ 0",-1 / 0);
echo(ceil(1/0)); echo(" 1/-0", 1 /-0);
echo(floor(1/0)); echo("-1/-0",-1 /-0);
echo(exp(2, 1/0));
echo(ln(1/0)); echo(" 0/ 1", 0 / 1);
echo(log(1/0)); echo("-0/ 1",-0 / 1);
echo(max(-1/0, 1/0)); echo(" 0/-1", 0 /-1);
echo(min(-1/0, 1/0)); echo("-0/-1",-0 /-1);
echo(pow(2, 1/0));
echo(round(1/0));
echo(sign(1/0)); echo( "sin( 0/ 0)",sin( 0/ 0));
echo(sign(-1/0)); echo( "sin(-0/ 0)",sin(-0/ 0));
echo(sqrt(1/0)); echo( "sin( 0/-0)",sin( 0/-0));
echo(sqrt(-1/0)); echo( "sin(-0/-0)",sin(-0/-0));
echo( "sin( 1/ 0)",sin( 1/ 0));
echo( "sin(-1/ 0)",sin(-1/ 0));
echo( "sin( 1/-0)",sin( 1/-0));
echo( "sin(-1/-0)",sin(-1/-0));
echo( "sin( 0/ 1)",sin( 0/ 1));
echo( "sin(-0/ 1)",sin(-0/ 1));
echo( "sin( 0/-1)",sin( 0/-1));
echo( "sin(-0/-1)",sin(-0/-1));
echo( "cos( 0/ 0)",cos( 0/ 0));
echo( "cos(-0/ 0)",cos(-0/ 0));
echo( "cos( 0/-0)",cos( 0/-0));
echo( "cos(-0/-0)",cos(-0/-0));
echo( "cos( 1/ 0)",cos( 1/ 0));
echo( "cos(-1/ 0)",cos(-1/ 0));
echo( "cos( 1/-0)",cos( 1/-0));
echo( "cos(-1/-0)",cos(-1/-0));
echo( "cos( 0/ 1)",cos( 0/ 1));
echo( "cos(-0/ 1)",cos(-0/ 1));
echo( "cos( 0/-1)",cos( 0/-1));
echo( "cos(-0/-1)",cos(-0/-1));
echo( "tan( 0/ 0)",tan( 0/ 0));
echo( "tan(-0/ 0)",tan(-0/ 0));
echo( "tan( 0/-0)",tan( 0/-0));
echo( "tan(-0/-0)",tan(-0/-0));
echo( "tan( 1/ 0)",tan( 1/ 0));
echo( "tan(-1/ 0)",tan(-1/ 0));
echo( "tan( 1/-0)",tan( 1/-0));
echo( "tan(-1/-0)",tan(-1/-0));
echo( "tan( 0/ 1)",tan( 0/ 1));
echo( "tan(-0/ 1)",tan(-0/ 1));
echo( "tan( 0/-1)",tan( 0/-1));
echo( "tan(-0/-1)",tan(-0/-1));
echo( "asin( 0/ 0)",asin( 0/ 0));
echo( "asin(-0/ 0)",asin(-0/ 0));
echo( "asin( 0/-0)",asin( 0/-0));
echo( "asin(-0/-0)",asin(-0/-0));
echo( "asin( 1/ 0)",asin( 1/ 0));
echo( "asin(-1/ 0)",asin(-1/ 0));
echo( "asin( 1/-0)",asin( 1/-0));
echo( "asin(-1/-0)",asin(-1/-0));
echo( "asin( 0/ 1)",asin( 0/ 1));
echo( "asin(-0/ 1)",asin(-0/ 1));
echo( "asin( 0/-1)",asin( 0/-1));
echo( "asin(-0/-1)",asin(-0/-1));
echo( "acos( 0/ 0)",acos( 0/ 0));
echo( "acos(-0/ 0)",acos(-0/ 0));
echo( "acos( 0/-0)",acos( 0/-0));
echo( "acos(-0/-0)",acos(-0/-0));
echo( "acos( 1/ 0)",acos( 1/ 0));
echo( "acos(-1/ 0)",acos(-1/ 0));
echo( "acos( 1/-0)",acos( 1/-0));
echo( "acos(-1/-0)",acos(-1/-0));
echo( "acos( 0/ 1)",acos( 0/ 1));
echo( "acos(-0/ 1)",acos(-0/ 1));
echo( "acos( 0/-1)",acos( 0/-1));
echo( "acos(-0/-1)",acos(-0/-1));
echo( "atan( 0/ 0)",atan( 0/ 0));
echo( "atan(-0/ 0)",atan(-0/ 0));
echo( "atan( 0/-0)",atan( 0/-0));
echo( "atan(-0/-0)",atan(-0/-0));
echo( "atan( 1/ 0)",atan( 1/ 0));
echo( "atan(-1/ 0)",atan(-1/ 0));
echo( "atan( 1/-0)",atan( 1/-0));
echo( "atan(-1/-0)",atan(-1/-0));
echo( "atan( 0/ 1)",atan( 0/ 1));
echo( "atan(-0/ 1)",atan(-0/ 1));
echo( "atan( 0/-1)",atan( 0/-1));
echo( "atan(-0/-1)",atan(-0/-1));
// atan2 has some interesting portability issues
// http://pubs.opengroup.org/onlinepubs/009695399/functions/atan2.html
// http://www.cplusplus.com/reference/cmath/atan2/
// http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx
echo("atan2( 0, 0)",atan2( 0, 0));
echo("atan2( -0, 0)",atan2( -0, 0));
echo("atan2( 0, -0)",atan2( 0, -0));
echo("atan2( -0, -0)",atan2( -0, -0));
echo("atan2( 0, 1)",atan2( 0, 1));
echo("atan2( 0, -1)",atan2( 0, -1));
echo("atan2( 1, 0)",atan2( 1, 0));
echo("atan2( -1, 0)",atan2( -1, 0));
echo("atan2( -0, 1)",atan2( -0, 1));
echo("atan2( -0, -1)",atan2( -0, -1));
echo("atan2( 1, -0)",atan2( 1, -0));
echo("atan2( -1, -0)",atan2( -1, -0));
echo("atan2( 1/0, 1/0)",atan2( 1/0, 1/0));
echo("atan2( 1/0,-1/0)",atan2( 1/0,-1/0));
echo("atan2(-1/0, 1/0)",atan2(-1/0, 1/0));
echo("atan2(-1/0,-1/0)",atan2(-1/0,-1/0));
echo("atan2( 1/0, 1 )",atan2( 1/0, 1 ));
echo("atan2( 1/0,-1 )",atan2( 1/0,-1 ));
echo("atan2(-1/0, 1 )",atan2(-1/0, 1 ));
echo("atan2(-1/0,-1 )",atan2(-1/0,-1 ));
echo("atan2( 1/0, 0 )",atan2( 1/0, 0 ));
echo("atan2( 1/0,-0 )",atan2( 1/0,-0 ));
echo("atan2(-1/0, 0 )",atan2(-1/0, 0 ));
echo("atan2(-1/0,-0 )",atan2(-1/0,-0 ));
echo("atan2( 1 , 1/0)",atan2( 1 , 1/0));
echo("atan2( 1 ,-1/0)",atan2( 1 ,-1/0));
echo("atan2(-1 , 1/0)",atan2(-1 , 1/0));
echo("atan2(-1 ,-1/0)",atan2(-1 ,-1/0));
echo("atan2( 0, 1/0)",atan2( 0, 1/0));
echo("atan2( 0,-1/0)",atan2( 0,-1/0));
echo("atan2( -0, 1/0)",atan2( -0, 1/0));
echo("atan2( -0,-1/0)",atan2( -0,-1/0));
echo( "ceil( 0/ 0)",ceil( 0/ 0));
echo( "ceil(-0/ 0)",ceil(-0/ 0));
echo( "ceil( 0/-0)",ceil( 0/-0));
echo( "ceil(-0/-0)",ceil(-0/-0));
echo( "ceil( 1/ 0)",ceil( 1/ 0));
echo( "ceil(-1/ 0)",ceil(-1/ 0));
echo( "ceil( 1/-0)",ceil( 1/-0));
echo( "ceil(-1/-0)",ceil(-1/-0));
echo( "ceil( 0/ 1)",ceil( 0/ 1));
echo( "ceil(-0/ 1)",ceil(-0/ 1));
echo( "ceil( 0/-1)",ceil( 0/-1));
echo( "ceil(-0/-1)",ceil(-0/-1));
echo( "floor( 0/ 0)",floor( 0/ 0));
echo( "floor(-0/ 0)",floor(-0/ 0));
echo( "floor( 0/-0)",floor( 0/-0));
echo( "floor(-0/-0)",floor(-0/-0));
echo( "floor( 1/ 0)",floor( 1/ 0));
echo( "floor(-1/ 0)",floor(-1/ 0));
echo( "floor( 1/-0)",floor( 1/-0));
echo( "floor(-1/-0)",floor(-1/-0));
echo( "floor( 0/ 1)",floor( 0/ 1));
echo( "floor(-0/ 1)",floor(-0/ 1));
echo( "floor( 0/-1)",floor( 0/-1));
echo( "floor(-0/-1)",floor(-0/-1));
echo( "ln( 0/ 0)",ln( 0/ 0));
echo( "ln(-0/ 0)",ln(-0/ 0));
echo( "ln( 0/-0)",ln( 0/-0));
echo( "ln(-0/-0)",ln(-0/-0));
echo( "ln( 1/ 0)",ln( 1/ 0));
echo( "ln(-1/ 0)",ln(-1/ 0));
echo( "ln( 1/-0)",ln( 1/-0));
echo( "ln(-1/-0)",ln(-1/-0));
echo( "ln( 0/ 1)",ln( 0/ 1));
echo( "ln(-0/ 1)",ln(-0/ 1));
echo( "ln( 0/-1)",ln( 0/-1));
echo( "ln(-0/-1)",ln(-0/-1));
echo( "log( 0/ 0)",log( 0/ 0));
echo( "log(-0/ 0)",log(-0/ 0));
echo( "log( 0/-0)",log( 0/-0));
echo( "log(-0/-0)",log(-0/-0));
echo( "log( 1/ 0)",log( 1/ 0));
echo( "log(-1/ 0)",log(-1/ 0));
echo( "log( 1/-0)",log( 1/-0));
echo( "log(-1/-0)",log(-1/-0));
echo( "log( 0/ 1)",log( 0/ 1));
echo( "log(-0/ 1)",log(-0/ 1));
echo( "log( 0/-1)",log( 0/-1));
echo( "log(-0/-1)",log(-0/-1));
echo( "round( 0/ 0)",round( 0/ 0));
echo( "round(-0/ 0)",round(-0/ 0));
echo( "round( 0/-0)",round( 0/-0));
echo( "round(-0/-0)",round(-0/-0));
echo( "round( 1/ 0)",round( 1/ 0));
echo( "round(-1/ 0)",round(-1/ 0));
echo( "round( 1/-0)",round( 1/-0));
echo( "round(-1/-0)",round(-1/-0));
echo( "round( 0/ 1)",round( 0/ 1));
echo( "round(-0/ 1)",round(-0/ 1));
echo( "round( 0/-1)",round( 0/-1));
echo( "round(-0/-1)",round(-0/-1));
echo( "sign( 0/ 0)",sign( 0/ 0));
echo( "sign(-0/ 0)",sign(-0/ 0));
echo( "sign( 0/-0)",sign( 0/-0));
echo( "sign(-0/-0)",sign(-0/-0));
echo( "sign( 1/ 0)",sign( 1/ 0));
echo( "sign(-1/ 0)",sign(-1/ 0));
echo( "sign( 1/-0)",sign( 1/-0));
echo( "sign(-1/-0)",sign(-1/-0));
echo( "sign( 0/ 1)",sign( 0/ 1));
echo( "sign(-0/ 1)",sign(-0/ 1));
echo( "sign( 0/-1)",sign( 0/-1));
echo( "sign(-0/-1)",sign(-0/-1));
echo( "sqrt( 0/ 0)",sqrt( 0/ 0));
echo( "sqrt(-0/ 0)",sqrt(-0/ 0));
echo( "sqrt( 0/-0)",sqrt( 0/-0));
echo( "sqrt(-0/-0)",sqrt(-0/-0));
echo( "sqrt( 1/ 0)",sqrt( 1/ 0));
echo( "sqrt(-1/ 0)",sqrt(-1/ 0));
echo( "sqrt( 1/-0)",sqrt( 1/-0));
echo( "sqrt(-1/-0)",sqrt(-1/-0));
echo( "sqrt( 0/ 1)",sqrt( 0/ 1));
echo( "sqrt(-0/ 1)",sqrt(-0/ 1));
echo( "sqrt( 0/-1)",sqrt( 0/-1));
echo( "sqrt(-0/-1)",sqrt(-0/-1));
echo( "pow(2, 0/ 0)",pow(2, 0/ 0));
echo( "pow(2,-0/ 0)",pow(2,-0/ 0));
echo( "pow(2, 0/-0)",pow(2, 0/-0));
echo( "pow(2,-0/-0)",pow(2,-0/-0));
echo( "pow(2, 1/ 0)",pow(2, 1/ 0));
echo( "pow(2,-1/ 0)",pow(2,-1/ 0));
echo( "pow(2, 1/-0)",pow(2, 1/-0));
echo( "pow(2,-1/-0)",pow(2,-1/-0));
echo( "pow(2, 0/ 1)",pow(2, 0/ 1));
echo( "pow(2,-0/ 1)",pow(2,-0/ 1));
echo( "pow(2, 0/-1)",pow(2, 0/-1));
echo( "pow(2,-0/-1)",pow(2,-0/-1));
echo( "exp(2, 0/ 0)",exp(2, 0/ 0));
echo( "exp(2,-0/ 0)",exp(2,-0/ 0));
echo( "exp(2, 0/-0)",exp(2, 0/-0));
echo( "exp(2,-0/-0)",exp(2,-0/-0));
echo( "exp(2, 1/ 0)",exp(2, 1/ 0));
echo( "exp(2,-1/ 0)",exp(2,-1/ 0));
echo( "exp(2, 1/-0)",exp(2, 1/-0));
echo( "exp(2,-1/-0)",exp(2,-1/-0));
echo( "exp(2, 0/ 1)",exp(2, 0/ 1));
echo( "exp(2,-0/ 1)",exp(2,-0/ 1));
echo( "exp(2, 0/-1)",exp(2, 0/-1));
echo( "exp(2,-0/-1)",exp(2,-0/-1));
echo("max( 0, 0)",max( 0, 0));
echo("max( -0, 0)",max( -0, 0));
echo("max( 0, -0)",max( 0, -0));
echo("max( -0, -0)",max( -0, -0));
echo("max( 0, 1)",max( 0, 1));
echo("max( 0, -1)",max( 0, -1));
echo("max( 1, 0)",max( 1, 0));
echo("max( -1, 0)",max( -1, 0));
echo("max( -0, 1)",max( -0, 1));
echo("max( -0, -1)",max( -0, -1));
echo("max( 1, -0)",max( 1, -0));
echo("max( -1, -0)",max( -1, -0));
echo("max( 1/0, 1/0)",max( 1/0, 1/0));
echo("max( 1/0,-1/0)",max( 1/0,-1/0));
echo("max(-1/0, 1/0)",max(-1/0, 1/0));
echo("max(-1/0,-1/0)",max(-1/0,-1/0));
echo("max( 1/0, 1 )",max( 1/0, 1 ));
echo("max( 1/0,-1 )",max( 1/0,-1 ));
echo("max(-1/0, 1 )",max(-1/0, 1 ));
echo("max(-1/0,-1 )",max(-1/0,-1 ));
echo("max( 1/0, 0 )",max( 1/0, 0 ));
echo("max( 1/0,-0 )",max( 1/0,-0 ));
echo("max(-1/0, 0 )",max(-1/0, 0 ));
echo("max(-1/0,-0 )",max(-1/0,-0 ));
echo("max( 1 , 1/0)",max( 1 , 1/0));
echo("max( 1 ,-1/0)",max( 1 ,-1/0));
echo("max(-1 , 1/0)",max(-1 , 1/0));
echo("max(-1 ,-1/0)",max(-1 ,-1/0));
echo("max( 0, 1/0)",max( 0, 1/0));
echo("max( 0,-1/0)",max( 0,-1/0));
echo("max( -0, 1/0)",max( -0, 1/0));
echo("max( -0,-1/0)",max( -0,-1/0));
echo("min( 0, 0)",min( 0, 0));
echo("min( -0, 0)",min( -0, 0));
echo("min( 0, -0)",min( 0, -0));
echo("min( -0, -0)",min( -0, -0));
echo("min( 0, 1)",min( 0, 1));
echo("min( 0, -1)",min( 0, -1));
echo("min( 1, 0)",min( 1, 0));
echo("min( -1, 0)",min( -1, 0));
echo("min( -0, 1)",min( -0, 1));
echo("min( -0, -1)",min( -0, -1));
echo("min( 1, -0)",min( 1, -0));
echo("min( -1, -0)",min( -1, -0));
echo("min( 1/0, 1/0)",min( 1/0, 1/0));
echo("min( 1/0,-1/0)",min( 1/0,-1/0));
echo("min(-1/0, 1/0)",min(-1/0, 1/0));
echo("min(-1/0,-1/0)",min(-1/0,-1/0));
echo("min( 1/0, 1 )",min( 1/0, 1 ));
echo("min( 1/0,-1 )",min( 1/0,-1 ));
echo("min(-1/0, 1 )",min(-1/0, 1 ));
echo("min(-1/0,-1 )",min(-1/0,-1 ));
echo("min( 1/0, 0 )",min( 1/0, 0 ));
echo("min( 1/0,-0 )",min( 1/0,-0 ));
echo("min(-1/0, 0 )",min(-1/0, 0 ));
echo("min(-1/0,-0 )",min(-1/0,-0 ));
echo("min( 1 , 1/0)",min( 1 , 1/0));
echo("min( 1 ,-1/0)",min( 1 ,-1/0));
echo("min(-1 , 1/0)",min(-1 , 1/0));
echo("min(-1 ,-1/0)",min(-1 ,-1/0));
echo("min( 0, 1/0)",min( 0, 1/0));
echo("min( 0,-1/0)",min( 0,-1/0));
echo("min( -0, 1/0)",min( -0, 1/0));
echo("min( -0,-1/0)",min( -0,-1/0));

View file

@ -74,7 +74,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../libraries/MCAD/__init__.py)
message(FATAL_ERROR "MCAD not found. You can install from the OpenSCAD root as follows: \n git submodule update --init") message(FATAL_ERROR "MCAD not found. You can install from the OpenSCAD root as follows: \n git submodule update --init")
endif() endif()
# NULLGL - Allow us to buidl without OpenGL(TM). run 'cmake .. -DNULLGL=1' # NULLGL - Allow us to build without OpenGL(TM). run 'cmake .. -DNULLGL=1'
# Most tests will fail, but it can be used for testing/experiments # Most tests will fail, but it can be used for testing/experiments
if(NULLGL) if(NULLGL)
@ -857,6 +857,7 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES}
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parent_module-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parent_module-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/children-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/children-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/range-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/range-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/empty-stl.scad) ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/empty-stl.scad)
list(APPEND DUMPTEST_FILES ${FEATURES_FILES} ${EXAMPLE_FILES}) list(APPEND DUMPTEST_FILES ${FEATURES_FILES} ${EXAMPLE_FILES})
@ -867,6 +868,7 @@ list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allexpressions.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allfunctions.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad) ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad)
list(APPEND CGALPNGTEST_FILES ${FEATURES_FILES} ${SCAD_DXF_FILES} ${EXAMPLE_FILES}) list(APPEND CGALPNGTEST_FILES ${FEATURES_FILES} ${SCAD_DXF_FILES} ${EXAMPLE_FILES})
@ -969,15 +971,11 @@ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py PYSRC)
set_target_properties(test_pretty_print PROPERTIES COMPILE_FLAGS set_target_properties(test_pretty_print PROPERTIES COMPILE_FLAGS
"-DPYBIN=${PYTHON_EXECUTABLE} -DPYSRC=${PYSRC} -DBUILDDIR=--builddir=${CMAKE_CURRENT_BINARY_DIR}" "-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 "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) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template TMP)
string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP}) string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP})
string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TMP}) string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TMP})
string(REPLACE __python__ ${PYTHON_EXECUTABLE} TMP ${TMP}) string(REPLACE __python_exec__ ${PYTHON_EXECUTABLE} TMP ${TMP})
string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template" TMP ${TMP}) string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template" TMP ${TMP})
string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP}) string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP})
string(REPLACE __openscad_binpath__ ${OPENSCAD_BINPATH} TMP ${TMP}) string(REPLACE __openscad_binpath__ ${OPENSCAD_BINPATH} TMP ${TMP})
@ -992,6 +990,12 @@ string(REPLACE __openscad_upload_tests__ "${UPLOADARG}" TMP ${TMP})
message(STATUS "creating CTestCustom.cmake") message(STATUS "creating CTestCustom.cmake")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP}) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake ${TMP})
# CTest_Cross_test template filling
if (MINGW_CROSS_ENV_DIR)
mingw_cross_fill_ctest_template()
endif()
# Add tests # Add tests
add_cmdline_test(moduledumptest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX ast FILES add_cmdline_test(moduledumptest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX ast FILES
@ -1013,7 +1017,7 @@ add_cmdline_test(opencsgtest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX png FILES ${
add_cmdline_test(throwntogethertest EXE ${OPENSCAD_BINPATH} ARGS --preview=throwntogether -o SUFFIX png FILES ${THROWNTOGETHERTEST_FILES}) add_cmdline_test(throwntogethertest EXE ${OPENSCAD_BINPATH} ARGS --preview=throwntogether -o SUFFIX png FILES ${THROWNTOGETHERTEST_FILES})
# FIXME: We don't actually need to compare the output of cgalstlsanitytest # FIXME: We don't actually need to compare the output of cgalstlsanitytest
# with anything. It's self-contained and returns != 0 on error # with anything. It's self-contained and returns != 0 on error
add_cmdline_test(cgalstlsanitytest EXE ${CMAKE_SOURCE_DIR}/cgalstlsanitytest SUFFIX txt ARGS ${OPENSCAD_BINPATH} FILES ${CGALSTLSANITYTEST_FILES}) add_cmdline_test(cgalstlsanitytest EXE ${OPENSCAD_BINPATH} ARGS -o SUFFIX stl FILES ${CGALSTLSANITYTEST_FILES})
# Add experimental tests # Add experimental tests

View file

@ -156,3 +156,22 @@ if( NOT cross_defs_set )
add_definitions( -DUNICODE ) # because qmake does it add_definitions( -DUNICODE ) # because qmake does it
set(cross_defs_set 1) set(cross_defs_set 1)
endif() endif()
#
# Part 5. Fill the ctest_cross_info.py.template into ctest_cross_info.py
#
function(mingw_cross_fill_ctest_template)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/ctest_cross_info.py.template TMP)
string(REPLACE __cmake_current_binary_dir__ ${CMAKE_CURRENT_BINARY_DIR} TMP ${TMP})
string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TMP})
string(REPLACE __python_exec__ ${PYTHON_EXECUTABLE} TMP ${TMP})
string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/ctest_cross_info.py.template" TMP ${TMP})
string(REPLACE __test_cmdline_tool__ "${tests_SOURCE_DIR}/test_cmdline_tool.py" TMP ${TMP})
string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP})
string(REPLACE __openscad_binpath__ ${OPENSCAD_BINPATH} TMP ${TMP})
string(REPLACE __convert_exec__ ${ImageMagick_convert_EXECUTABLE} TMP ${TMP})
message(STATUS "creating ctest_cross_info.py from ctest_cross_info.py.template")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ctest_cross_info.py ${TMP})
endfunction()

View file

@ -67,7 +67,7 @@ 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) 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") set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__cmake_current_binary_dir__/test_pretty_print")
else() else()
set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__python__ \"__cmake_current_source_dir__/test_pretty_print.py\" --builddir=__cmake_current_binary_dir__ __openscad_upload_tests__") set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__python_exec__ \"__cmake_current_source_dir__/test_pretty_print.py\" --builddir=__cmake_current_binary_dir__ __openscad_upload_tests__")
endif() endif()
if ( ${debug_openscad_template} ) if ( ${debug_openscad_template} )

View file

@ -0,0 +1,420 @@
# CTest Cross Console, by Don Bright http://github.com/donbright
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of the organization nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This script attempts to provide a 'portable' way to run CTest tests on
# machines other than the original build machine, for both
# cross-compiled and non-cross-compiled situations. The running of this
# script will, in theory, modify CTestTestfile.cmake and open a command
# prompt so that typing 'ctest' will run the test suite properly.
#
# Usage
#
# python CTest_Cross_Console.py # basic run
# python CTest_Cross_Console.py --debug # provide debug info
# python CTest_Cross_Console.py --debug2 # provide much more debug info
# python CTest_Cross_Console.py --undo # undo changes to CTestTestfile
# Internal operation
#
# Stage 1
# Load a set of 'original paths' set by CMake during the creation of the
# CTestTestfile.cmake. (using something like 'execfile')
#
# Stage 2
# Attempt to find various programs on the test system, such as python,
# ImageMagick, and ctest
#
# Stage 3
# Combine the results of stage 1 and 2, to replace all build-machine
# paths in CTestTestfile.cmake with test-machine paths. Note that paths
# in CMake are always separated by '/' even on Windows(TM)
#
# Stage 4
# Open a simple command-prompt on the test machine, but with the environment
# variables & current directory chosen so that simply typing 'ctest'
# will successfully run the test script.
#
# Note - On Windows(TM) there are problems with unicode filenames
# Note - This script is designed to work with the OpenSCAD project
# tests and their cross-compilation environment. It will not
# automatically work with any given ctest system.
#
# Tested Machine combinations: (* indicates success)
#
# Build machine Test-run machine
# ------------- ----------------
# Linux cross MXE Windows*
# Linux cross MXE WINE in Linux*
# Linux Linux x86
# OSX OSX
# Windows Windows
#
import os,sys,string,time
debugfile=None
def debug(*args):
global debugfile
if debugfile==None:
debugfile=open(u'debuglog.txt',u'w')
if u'--debug' in string.join(sys.argv):
s = u''
for arg in args: s += unicode(arg) + u' '
debugfile.write((s+u'\n').encode('utf-8'))
print s.encode('utf-8')
sys.stdout.flush()
def debug2(*args):
if u'--debug2' in string.join(sys.argv): debug(args)
def uprint(*args):
s=''
for arg in args: s += unicode(arg) + u' '
if '--debug' in string.join(sys.argv): debug(s.encode('utf-8'))
else: print s.encode('utf-8')
sys.stdout.flush()
def startup():
debug(u'debugging is on. startup environment:')
debug(u'sys.executable:',sys.executable)
debug(u'sys.version:',sys.version.replace(u'\n',u' '))
debug(u'sys.argv:',sys.argv)
debug(u'sys.path:',sys.path)
debug(u'sys.platform:',sys.platform)
debug(u'sys.meta_path:',sys.meta_path)
debug(u'abspath(os.curdir):',os.path.abspath(unicode(os.curdir)))
debug(u'sys.stdout.encoding:',sys.stdout.encoding)
debug(u'sys.getdefaultencoding:',sys.getdefaultencoding())
debug(u'sys.getfilesystemencoding:',sys.getfilesystemencoding())
if os.environ.has_key(u'PYTHONPATH'):
debug(u'PYTHONPATH:',os.environ[u'PYTHONPATH'])
else:
debug(u'PYTHONPATH: ')
# sys.path modification allows 'import ctest_cross_info' to work properly
sys.path = [os.path.join(os.path.abspath(os.curdir),u'testbin')]+sys.path
debug(u'sys.path after modification: ',sys.path)
class CTestPaths:
def __init__(self,name):
self.name=name
self.abs_cmake_srcdir=self.abs_cmake_bindir=u'unset'
self.bindir=self.openscad_exec=self.python_exec=u'unset'
self.convert_exec=self.ctest_exec=u'unset'
def dump(self):
s=u''
s+=u'CTestPaths dump:\nname:'+self.name+u'\n'
s+=u'abs_cmake_srcdir:'+self.abs_cmake_srcdir+u'\n'
s+=u'abs_cmake_bindir:'+self.abs_cmake_bindir+u'\n'
s+=u'bindir:'+self.bindir+u'\n'
s+=u'openscad_exec:'+self.openscad_exec+u'\n'
s+=u'python_exec:'+self.python_exec+u'\n'
s+=u'convert_exec:'+self.convert_exec+u'\n'
s+=u'ctest_exec:'+self.ctest_exec+u'\n'
return s
def normalize(self):
self.abs_cmake_srcdir=os.path.realpath(self.abs_cmake_srcdir)
self.abs_cmake_bindir=os.path.realpath(self.abs_cmake_bindir)
self.bindir=os.path.realpath(self.bindir)
self.openscad_exec=os.path.realpath(self.openscad_exec)
self.python_exec=os.path.realpath(self.python_exec)
self.convert_exec=os.path.realpath(self.convert_exec)
self.ctest_exec=os.path.realpath(self.ctest_exec)
def findfail(progname):
uprint(u'cant find ',progname,u'. exiting in ')
for i in range(0,7):
time.sleep(1)
print 7-i,u'.',
sys.stdout.flush()
sys.exit()
def windows__find_im_in_registry():
debug(u'searching for imagemagick convert.exe using registry')
imbinpath = u''
try:
registry = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
regkey = OpenKey(registry, r"SOFTWARE\ImageMagick\Current")
tmp = QueryValueEx(regkey,u'BinPath')[0]
imbinpath = tmp
except Exception as e:
debug( "Can't find imagemagick using registry...")
debug( u'Exception was:',str(type(e))+str(e))
convert_exec = os.path.join(imbinpath,u'convert.exe')
if os.path.isfile(convert_exec): return convert_exec
return None
def windows__find_prog_in_PATH(progname):
if not os.environ.has_key['PATH']: return None
for path in os.environ['PATH'].split(os.pathsep):
if os.path.isfile(os.path.join(path,progname)):
return os.path.join(path,progname)
return None
def windows__find_im_in_pfiles():
uprint(u'Searching for ImageMagick convert.exe in Program folders')
convert_exec = None
tmp = None
for basedir in u'C:/Program Files',u'C:/Program Files (x86)':
if os.path.isdir(basedir):
pflist=os.listdir(basedir)
for subdir in pflist:
debug2(subdir)
if u'ImageMagick' in subdir:
imbase = basedir+u'/'+subdir
tmp = imbase+u'/convert.exe'
if os.path.isfile(tmp):
convert_exec = unicode(tmp)
break
if convert_exec != u'' or convert_exec != None: break
return convert_exec
def windows__find_ctest_in_pfiles():
uprint( u'Searching for ctest.exe in Program folders')
ctestpath = None
for basedir in u'C:/Program Files',u'C:/Program Files (x86)':
if os.path.isdir(basedir):
pflist = os.listdir(basedir)
for subdir in pflist:
if u'cmake' in subdir.lower():
abssubdir=os.path.join(basedir,subdir)
for root,dirs,files in os.walk(abssubdir):
if u'ctest.exe' in files:
ctestpath=os.path.join(root,u'ctest.exe')
return unicode(ctestpath)
def windows__fillpaths(paths):
thisfile_abspath=unicode(os.path.abspath(unicode(__file__)))
thisfile_absdir=unicode(os.path.dirname(thisfile_abspath))
paths.abs_cmake_srcdir = os.path.join(thisfile_absdir,u'tests')
paths.abs_cmake_bindir = os.path.join(thisfile_absdir,u'testbin')
paths.bindir = u''
paths.tct = os.path.join(thisfile_abspath,u'tests')
paths.tct = os.path.join(paths.tct,u'test_cmdline_tool.py')
debug(paths.dump())
paths.python_exec=sys.executable
if paths.python_exec==u'' or paths.python_exec==None:
findfail(u'python2')
paths.convert_exec=windows__find_im_in_registry()
if paths.convert_exec==None:
paths.convert_exec=windows__find_im_in_pfiles()
if paths.convert_exec==None:
paths.convert_exec=windows__find_prog_in_PATH(u'convert.exe')
if paths.convert_exec==None:
findfail(u'imagemagick convert')
paths.openscad_exec=os.path.join(paths.abs_cmake_bindir,u'openscad_nogui.exe')
if not os.path.isfile(paths.openscad_exec):
paths.openscad_exec=windows__find_prog_in_PATH(u'openscad_nogui.exe')
if paths.openscad_exec==None:
findfail(paths.openscad_exec)
paths.ctest_exec=windows__find_ctest_in_pfiles()
if paths.ctest_exec==None:
paths.ctest_exec=windows__find_prog_in_PATH(u'ctest.exe')
if paths.ctest_exec==None:
findfail(u'ctest.exe')
paths.normalize()
def get_template_scad_list(basedir):
newscads=[]
for r,ds,fs in os.walk('testdata'):
if 'templates' in r:
for f in fs:
debug('testdata tempalte file:',f)
fnew=f.replace('-template','')
newscads += [fnew]
print 'newscads',newscads
scadlist=[]
for scadname in newscads:
for r,ds,fs in os.walk('testdata'):
if scadname in fs:
debug('testdata template new:',scadname)
scadlist += [ os.path.join(r,scadname) ]
debug('scadlist result',scadlist)
return scadlist
def process_scadfile(infilename,buildpaths,testpaths):
infilename=unicode(infilename)
if not os.path.exists(infilename): findfail(infilename)
bp=buildpaths
tp=testpaths
backup_filename = infilename+u'.backup'
outfilename = infilename.replace(u'.scad',u'.new.scad')
fin=open(infilename,u'rb')
lines=fin.readlines()
for line in lines:
if '// modified by '+__file__ in line:
uprint('already modified',infilename)
fin.close()
return
fout=open(outfilename,u'wb')
fout.write(u'//'+os.linesep)
fout.write(u'// modified by '+unicode(__file__+os.linesep))
fout.write(u'//'+os.linesep)
debug2(u'inputname',infilename)
debug2(u'outputname',outfilename)
for line in lines:
debug2(u'input:',line)
line=line.decode(u'utf-8')
if bp.abs_cmake_srcdir in line:
line=line.replace(bp.abs_cmake_srcdir,tp.abs_cmake_srcdir)
if 'win' in sys.platform:
line=line.replace('\\','/')
debug2(u'output:',line)
line=line.encode(u'utf-8')
fout.write(line)
debug2( u'backed up ',infilename, u'to', backup_filename )
debug2( u'processed ',infilename, u'to', outfilename )
fin.close()
fout.close()
open(infilename,u'wb').write(open(outfilename,u'rb').read())
uprint(infilename,u'modified \n(old version saved to:',backup_filename,u')')
def process_ctestfile(infilename,buildpaths,testpaths):
infilename=unicode(infilename)
if not os.path.exists(infilename): findfail(infilename)
bp=buildpaths
tp=testpaths
backup_filename = infilename+u'.backup'
if u'--undo' in string.join(sys.argv):
open(infilename,u'wb').write(open(backup_filename,u'rb').read())
uprint(u'restored ',infilename,u'from backup')
return
open(backup_filename,u'wb').write(open(infilename,u'rb').read())
debug2 (u'wrote backup of ',infilename,u' to ',backup_filename)
outfilename = infilename.replace(u'.cmake',u'.new.cmake')
fin=open(infilename,u'rb')
lines=fin.readlines()
for line in lines:
if '# modified by '+__file__ in line:
uprint('already modified',infilename)
fin.close()
return
fout=open(outfilename,u'wb')
fout.write(u'#'+os.linesep)
fout.write(u'# modified by '+unicode(__file__+os.linesep))
fout.write(u'#'+os.linesep)
debug2(u'inputname',infilename)
debug2(u'outputname',outfilename)
for line in lines:
debug2(u'input:',line)
line=line.decode(u'utf-8') # CTest in theory uses utf-8
# special for CTestCustom.template + ctest bugs w arguments
line=line.replace(u'--builddir='+tp.abs_cmake_bindir,u'')
line=line.replace(bp.abs_cmake_srcdir,tp.abs_cmake_srcdir)
line=line.replace(bp.abs_cmake_bindir,tp.abs_cmake_bindir)
line=line.replace(bp.bindir,tp.bindir)
line=line.replace(bp.openscad_exec,tp.openscad_exec)
line=line.replace(bp.python_exec,tp.python_exec)
line=line.replace(bp.convert_exec,tp.convert_exec)
line=line.replace(bp.ctest_exec,tp.ctest_exec)
if 'win' in sys.platform:
line=line.replace(u'\\"',u'__ESCAPE_WIN_QUOTE_MECHANISM__')
line=line.replace(u'\\',u'/')
line=line.replace(u'__ESCAPE_WIN_QUOTE_MECHANISM__',u'\\"')
debug2(u'output:',line)
line=line.encode(u'utf-8') # Ctest, in theory, uses utf-8
fout.write(line)
debug2( u'backed up ',infilename, u'to', backup_filename )
debug2( u'processed ',infilename, u'to', outfilename )
fin.close()
fout.close()
open(infilename,u'wb').write(open(outfilename,u'rb').read())
uprint(infilename,u'modified \n(old version saved to:',backup_filename,u')')
def windows__open_console(cmake_bindir):
# open a cmd.exe console in the given directory. also run a
# short 'batch file' that will display a short help message
#
# dont use full path for os.system() call. windows(TM) unicode
# filenames will not work properly inside os.system(). the
# workaround is to use os.chdir() (which does work OK with
# windows(TM) unicode filenames) and then open the .batch file
# with its ascii name, not its full path.
starting_dir=unicode(cmake_bindir)
debug(u'changing directory to',starting_dir)
os.chdir(starting_dir)
batchfile=u'mingwcon.bat'
if not os.path.isfile(batchfile): findfail(batchfile)
cmd = u'start cmd.exe "/k" "'+batchfile+u'"'
uprint(u'opening console: running ',cmd)
os.system( cmd.encode('mbcs') )
def open_console(testpaths):
uprint( u'opening console' )
ctestdir = os.path.dirname( testpaths.ctest_exec )
uprint( u'ctest dir:',ctestdir )
if ctestdir != u'' or ctestdir==None:
uprint( u'adding ctest dir to PATH' )
os.environ[u'PATH'] = ctestdir + os.pathsep + os.environ[u'PATH']
if u'win' in sys.platform:
windows__open_console(testpaths.abs_cmake_bindir)
sys.argv+=[u'--debug']
# sys.argv+=[u'--debug2']
startup()
buildpaths = CTestPaths(u'buildpaths')
testpaths = CTestPaths(u'testpaths')
execfile(os.path.join(u'testbin',u'ctest_cross_info.py'))
set_buildpaths( buildpaths )
if u'win' in sys.platform:
from _winreg import *
windows__fillpaths( testpaths )
debug(buildpaths.dump()+u'\n'+testpaths.dump()+u'\n')
ctestfile1 = os.path.join(testpaths.abs_cmake_bindir,u'CTestTestfile.cmake')
ctestfile2 = os.path.join(testpaths.abs_cmake_bindir,u'CTestCustom.cmake')
process_ctestfile(ctestfile1,buildpaths,testpaths)
process_ctestfile(ctestfile2,buildpaths,testpaths)
scads = get_template_scad_list(os.path.join(testpaths.abs_cmake_srcdir,u'testdata'))
for scadfile in scads:
process_scadfile(scadfile,buildpaths,testpaths)
open_console( testpaths )

View file

@ -1,56 +0,0 @@
# 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>
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)
build_dir=starting_dir
print 'converting CTestTestfile.cmake by calling mingw_convert_test.py'
import mingw_convert_ctest
mingw_convert_ctest.run()
print 'searching for ctest.exe'
ctestpath=''
for basedir in 'C:/Program Files','C:/Program Files (x86)':
if os.path.isdir(basedir):
pflist = os.listdir(basedir)
for subdir in pflist:
if 'cmake' in subdir.lower():
abssubdir=os.path.join(basedir,subdir)
for root,dirs,files in os.walk(abssubdir):
if 'ctest.exe' in files:
ctestpath=os.path.join(root,'ctest.exe')
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
#cmd = 'start "OpenSCAD Test console" /wait /d c:\\temp cmd.exe'
#cmd = 'start /d "'+starting_dir+'" cmd.exe "OpenSCAD Test Console"'
conbat=os.path.join(build_dir,'mingwcon.bat')
cmd = 'start /d "'+starting_dir+'" cmd.exe "/k" "'+conbat+'"'
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?

View file

@ -5,11 +5,11 @@ OpenSCAD runs as expected from release to release, and from platform to
platform. To use this test suite you must also have the following platform. To use this test suite you must also have the following
systems installed on your machine: systems installed on your machine:
Python 2 http://www.python.org Python 2 http://www.python.org (Note: Python 3 will not work)
CMake http://www.cmake.org CMake http://www.cmake.org
ImageMagick http://www.imagemagick.org ImageMagick http://www.imagemagick.org
To run the test suite, first click on the "OpenSCAD_Test_Console.py" file to To run the test suite, first click on the "CTest_Cross_Console.py" file to
run it. It should open a cmd.exe console in the tests-build folder. Type run it. It should open a cmd.exe console in the tests-build folder. Type
ctest ctest
@ -21,16 +21,25 @@ debugging and testing process.
Thanks for helping test OpenSCAD. Thanks for helping test OpenSCAD.
See doc/testing.txt in the OpenSCAD source code for more details. Troubleshooting:
Known bugs: -CMake 2.8.x for Windows does not properly operate from folders with
Unicode in the pathname. The workaround is to move the Tests to a folder
that has no Unicode in any of the parent folder names, such as creating
a folder called 'c:\temp'.
-These scripts will not find ImageMagick or CMake if they are not -The script will only find ImageMagick and Cmake if they are
installed on the C: drive under Program Files*. As a workaround, you can installed under standard locations (C:\Program Files) or if their
edit the OpenSCAD_Test_Console.py file and the .py files in the executables are in the PATH environment variable. As a workaround, you
tests-build directory. can edit the OpenSCAD_Test_Console.py file to set their location.
-'Diff' text-tests may not run properly on Windows(TM). -The main OpenSCAD Tests .zip file must be extracted before running the
tests. It will not work if the .zip file is only double-clicked, a full
extraction must be performed. Instructions on extracting .zip files can
be found with a web-search. Third-party tools like '7-zip'
(http://7-zip.org) can make extraction much easier.
-Detection of ctest, python, and imagemagick doesnt always work properly See Also:
./doc/testing.txt
http://github.com/openscad/openscad/issues

View file

@ -1,16 +0,0 @@
#!/usr/bin/env python
import re, sys, subprocess, os
stlfile = sys.argv[3] + '.stl'
subprocess.check_call([sys.argv[2], sys.argv[1], '-o', stlfile])
result = open(stlfile).read()
os.unlink(stlfile)
if 'nan' in result or 'inf' in result:
sys.exit(1)
open(sys.argv[3], 'w').write('') # this check only works on return values

View file

@ -0,0 +1,14 @@
# ctest_cross_info.py.template --> should be modified during CMake run
# By CMingw-cross-env.cmake or CMakeLists.txt
# __header__
def set_buildpaths(paths):
paths.abs_cmake_srcdir='__cmake_current_source_dir__'
paths.abs_cmake_bindir='__cmake_current_binary_dir__'
paths.bindir='__cmake_current_binary_dir__'
paths.abs_test_cmdline_tool='__test_cmdline_tool__'
paths.python_exec='__python_exec__'
paths.convert_exec='__convert_exec__'
paths.ctest_exec='__ctest_exec__'
paths.openscad_exec='__openscad_binpath__'
paths.cmake_sysname='__cmake_system_name__'

View file

@ -1,190 +0,0 @@
#!/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 by scripts/release-common.sh during 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
from _winreg import *
_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'
# FIXME - find 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=''
winconv=''
try:
registry = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
regkey = OpenKey(registry, r"SOFTWARE\ImageMagick\Current")
imbinpath = QueryValueEx(regkey, 'BinPath')[0]
except Exception as e:
print "Can't find imagemagick using registry...",
print str(type(e))+str(e)
pass
print 'Searching for ImageMagick in Program folders'
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 os.path.isfile(winconv):
break
if winconv != '': break
if 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
if True:
print thisfile_abspath
print 'linbase',linbase
print 'winbase',winbase
print 'linbuild',linbuild
print 'winbuild',winbuild
print 'lintct',lintct
print 'wintct',wintct
print 'linpy',linpy
print 'winpy',winpy
print 'linosng',linosng
print 'winosng',winosng
print 'linconv',linconv
print 'winconv',winconv
print 'linoslib',linoslib
print 'winoslib',winoslib
print 'lintestdata',lintestdata
print 'wintestdata',wintestdata
print 'linexamples',linexamples
print 'winexamples',winexamples
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)
# special for CTestCustom.template + ctest bugs w arguments
line=line.replace('--builddir='+linbuild,'')
line=line.replace(linbuild,winbuild)
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('\\"','__ESCAPE_WIN_QUOTE_MECHANISM__')
line=line.replace('\\','/')
line=line.replace('__ESCAPE_WIN_QUOTE_MECHANISM__','\\"')
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'
def run():
processfile('CTestTestfile.cmake')
processfile('CTestCustom.cmake')
if __name__=='__main__':
run()

View file

@ -1,11 +1,11 @@
@echo off @echo off
@echo Welcome to the OpenSCAD test console. Basic commands: @echo Welcome to the OpenSCAD test console. Basic commands:
@echo. @echo.
@echo ctest :: run standard set of tests @echo ctest :: run standard set of tests
@echo ctest -C All :: run all tests @echo ctest -R circle :: run standard tests with 'circle' in name
@echo ctest -R cgal.*circle :: run all tests named 'cgal ... circle' @echo ctest -R cgal.*circle :: run standard tests matching 'cgal.*circle'
@echo. @echo ctest -C All :: run all tests
@echo (For full instructions please see ..\doc\testing.txt) @echo ctest -C All -R circle :: run all tests with 'circle' in name
@echo. @echo.
@echo on @echo on

View file

@ -112,16 +112,16 @@ group() {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 75, r1 = 6, r2 = 2, center = false); cylinder($fn = 0, $fa = 12, $fs = 2, h = 75, r1 = 6, r2 = 2, center = false);
} }
multmatrix([[1, 0, 0, 85], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 85], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 70.0714, r1 = 6, r2 = 2, center = false); cylinder($fn = 0, $fa = 12, $fs = 2, h = 70.07142857142, r1 = 6, r2 = 2, center = false);
} }
multmatrix([[1, 0, 0, 90], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 90], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 65.1429, r1 = 6, r2 = 2, center = false); cylinder($fn = 0, $fa = 12, $fs = 2, h = 65.14285714285, r1 = 6, r2 = 2, center = false);
} }
multmatrix([[1, 0, 0, 95], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 95], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 60.2143, r1 = 6, r2 = 2, center = false); cylinder($fn = 0, $fa = 12, $fs = 2, h = 60.21428571428, r1 = 6, r2 = 2, center = false);
} }
multmatrix([[1, 0, 0, 100], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 100], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 55.2857, r1 = 6, r2 = 2, center = false); cylinder($fn = 0, $fa = 12, $fs = 2, h = 55.28571428571, r1 = 6, r2 = 2, center = false);
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -35,10 +35,10 @@ group() {
sphere($fn = 16, $fa = 12, $fs = 2, r = 0.7); sphere($fn = 16, $fa = 12, $fs = 2, r = 0.7);
} }
multmatrix([[1, 0, 0, 0], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
cube(size = [1.5708, 0.5, 0.5], center = true); cube(size = [1.57079632677, 0.5, 0.5], center = true);
} }
multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
cube(size = [1.43239, 0.5, 0.5], center = true); cube(size = [1.43239448784, 0.5, 0.5], center = true);
} }
multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, -0.5], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, -0.5], [0, 0, 0, 1]]) {
multmatrix([[0.05, 0, 0, 0], [0, 0.05, 0, 0], [0, 0, 0.05, 0], [0, 0, 0, 1]]) { multmatrix([[0.05, 0, 0, 0], [0, 0.05, 0, 0], [0, 0, 0.05, 0], [0, 0, 0, 1]]) {

View file

@ -47,13 +47,13 @@ group() {
group() { group() {
render(convexity = 1) { render(convexity = 1) {
difference() { difference() {
square(size = [1e+06, 1e+06], center = true); square(size = [1000000, 1000000], center = true);
minkowski(convexity = 0) { minkowski(convexity = 0) {
circle($fn = 0, $fa = 12, $fs = 2, r = 0.3); circle($fn = 0, $fa = 12, $fs = 2, r = 0.3);
group() { group() {
render(convexity = 1) { render(convexity = 1) {
difference() { difference() {
square(size = [1e+06, 1e+06], center = true); square(size = [1000000, 1000000], center = true);
minkowski(convexity = 0) { minkowski(convexity = 0) {
circle($fn = 0, $fa = 12, $fs = 2, r = 0.4); circle($fn = 0, $fa = 12, $fs = 2, r = 0.4);
circle($fn = 0, $fa = 12, $fs = 2, r = 4); circle($fn = 0, $fa = 12, $fs = 2, r = 4);
@ -74,13 +74,13 @@ group() {
group() { group() {
render(convexity = 1) { render(convexity = 1) {
difference() { difference() {
square(size = [1e+06, 1e+06], center = true); square(size = [1000000, 1000000], center = true);
minkowski(convexity = 0) { minkowski(convexity = 0) {
circle($fn = 0, $fa = 12, $fs = 2, r = 0.3); circle($fn = 0, $fa = 12, $fs = 2, r = 0.3);
group() { group() {
render(convexity = 1) { render(convexity = 1) {
difference() { difference() {
square(size = [1e+06, 1e+06], center = true); square(size = [1000000, 1000000], center = true);
minkowski(convexity = 0) { minkowski(convexity = 0) {
difference() { difference() {
circle($fn = 0, $fa = 12, $fs = 2, r = 0.4); circle($fn = 0, $fa = 12, $fs = 2, r = 0.4);

View file

@ -264,7 +264,7 @@ group() {
} }
multmatrix([[1, 0, 0, 70], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 70], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [0,0,0.5], auto = [0,0,0]) { resize(newsize = [0,0,0.5], auto = [0,0,0]) {
cube(size = [6, 6, 1e+10], center = false); cube(size = [6, 6, 10000000000], center = false);
} }
} }
} }

View file

@ -0,0 +1,12 @@
group() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 1);
multmatrix([[nan, nan, nan, 0], [nan, nan, nan, 0], [nan, nan, nan, 0], [0, 0, 0, 1]]) {
cube(size = [1, 1, 1], center = false);
}
multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
sphere($fn = 0, $fa = 12, $fs = 2, r = 1);
multmatrix([[nan, nan, nan, 0], [nan, nan, nan, 0], [nan, nan, nan, 0], [0, 0, 0, 1]]) {
cube(size = [1, 1, 1], center = false);
}
}
}

View file

@ -47,7 +47,7 @@ group() {
projection(cut = false, convexity = 0) { projection(cut = false, convexity = 0) {
multmatrix([[0, 0, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]) { multmatrix([[0, 0, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.31819805153], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.31819805153], [0, 0, 0, 1]]) {
cylinder($fn = 30, $fa = 12, $fs = 2, h = 0.212132, r1 = 0.212132, r2 = 0, center = true); cylinder($fn = 30, $fa = 12, $fs = 2, h = 0.21213203435, r1 = 0.21213203435, r2 = 0, center = true);
} }
} }
} }
@ -57,7 +57,7 @@ group() {
} }
} }
multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, -2], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) {
cube(size = [1.43239, 0.5, 0.5], center = true); cube(size = [1.43239448784, 0.5, 0.5], center = true);
} }
multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, -0.5], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 2], [0, 1, 0, -4], [0, 0, 1, -0.5], [0, 0, 0, 1]]) {
multmatrix([[0.05, 0, 0, 0], [0, 0.05, 0, 0], [0, 0, 0.05, 0], [0, 0, 0, 1]]) { multmatrix([[0.05, 0, 0, 0], [0, 0.05, 0, 0], [0, 0, 0.05, 0], [0, 0, 0, 1]]) {

View file

@ -1,23 +1,290 @@
ECHO: inf ECHO: "0", 0
ECHO: -inf ECHO: "-0", 0
ECHO: nan ECHO: " 0/ 0", nan
ECHO: nan ECHO: "-0/ 0", nan
ECHO: nan ECHO: " 0/-0", nan
ECHO: nan ECHO: "-0/-0", nan
ECHO: nan ECHO: " 1/ 0", inf
ECHO: 90 ECHO: "-1/ 0", -inf
ECHO: -90 ECHO: " 1/-0", -inf
ECHO: 135 ECHO: "-1/-0", inf
ECHO: inf ECHO: " 0/ 1", 0
ECHO: inf ECHO: "-0/ 1", 0
ECHO: undef ECHO: " 0/-1", 0
ECHO: inf ECHO: "-0/-1", 0
ECHO: inf ECHO: "sin( 0/ 0)", nan
ECHO: inf ECHO: "sin(-0/ 0)", nan
ECHO: -inf ECHO: "sin( 0/-0)", nan
ECHO: inf ECHO: "sin(-0/-0)", nan
ECHO: inf ECHO: "sin( 1/ 0)", nan
ECHO: 1 ECHO: "sin(-1/ 0)", nan
ECHO: -1 ECHO: "sin( 1/-0)", nan
ECHO: inf ECHO: "sin(-1/-0)", nan
ECHO: nan ECHO: "sin( 0/ 1)", 0
ECHO: "sin(-0/ 1)", 0
ECHO: "sin( 0/-1)", 0
ECHO: "sin(-0/-1)", 0
ECHO: "cos( 0/ 0)", nan
ECHO: "cos(-0/ 0)", nan
ECHO: "cos( 0/-0)", nan
ECHO: "cos(-0/-0)", nan
ECHO: "cos( 1/ 0)", nan
ECHO: "cos(-1/ 0)", nan
ECHO: "cos( 1/-0)", nan
ECHO: "cos(-1/-0)", nan
ECHO: "cos( 0/ 1)", 1
ECHO: "cos(-0/ 1)", 1
ECHO: "cos( 0/-1)", 1
ECHO: "cos(-0/-1)", 1
ECHO: "tan( 0/ 0)", nan
ECHO: "tan(-0/ 0)", nan
ECHO: "tan( 0/-0)", nan
ECHO: "tan(-0/-0)", nan
ECHO: "tan( 1/ 0)", nan
ECHO: "tan(-1/ 0)", nan
ECHO: "tan( 1/-0)", nan
ECHO: "tan(-1/-0)", nan
ECHO: "tan( 0/ 1)", 0
ECHO: "tan(-0/ 1)", 0
ECHO: "tan( 0/-1)", 0
ECHO: "tan(-0/-1)", 0
ECHO: "asin( 0/ 0)", nan
ECHO: "asin(-0/ 0)", nan
ECHO: "asin( 0/-0)", nan
ECHO: "asin(-0/-0)", nan
ECHO: "asin( 1/ 0)", nan
ECHO: "asin(-1/ 0)", nan
ECHO: "asin( 1/-0)", nan
ECHO: "asin(-1/-0)", nan
ECHO: "asin( 0/ 1)", 0
ECHO: "asin(-0/ 1)", 0
ECHO: "asin( 0/-1)", 0
ECHO: "asin(-0/-1)", 0
ECHO: "acos( 0/ 0)", nan
ECHO: "acos(-0/ 0)", nan
ECHO: "acos( 0/-0)", nan
ECHO: "acos(-0/-0)", nan
ECHO: "acos( 1/ 0)", nan
ECHO: "acos(-1/ 0)", nan
ECHO: "acos( 1/-0)", nan
ECHO: "acos(-1/-0)", nan
ECHO: "acos( 0/ 1)", 90
ECHO: "acos(-0/ 1)", 90
ECHO: "acos( 0/-1)", 90
ECHO: "acos(-0/-1)", 90
ECHO: "atan( 0/ 0)", nan
ECHO: "atan(-0/ 0)", nan
ECHO: "atan( 0/-0)", nan
ECHO: "atan(-0/-0)", nan
ECHO: "atan( 1/ 0)", 90
ECHO: "atan(-1/ 0)", -90
ECHO: "atan( 1/-0)", -90
ECHO: "atan(-1/-0)", 90
ECHO: "atan( 0/ 1)", 0
ECHO: "atan(-0/ 1)", 0
ECHO: "atan( 0/-1)", 0
ECHO: "atan(-0/-1)", 0
ECHO: "atan2( 0, 0)", 0
ECHO: "atan2( -0, 0)", 0
ECHO: "atan2( 0, -0)", 180
ECHO: "atan2( -0, -0)", -180
ECHO: "atan2( 0, 1)", 0
ECHO: "atan2( 0, -1)", 180
ECHO: "atan2( 1, 0)", 90
ECHO: "atan2( -1, 0)", -90
ECHO: "atan2( -0, 1)", 0
ECHO: "atan2( -0, -1)", -180
ECHO: "atan2( 1, -0)", 90
ECHO: "atan2( -1, -0)", -90
ECHO: "atan2( 1/0, 1/0)", 45
ECHO: "atan2( 1/0,-1/0)", 135
ECHO: "atan2(-1/0, 1/0)", -45
ECHO: "atan2(-1/0,-1/0)", -135
ECHO: "atan2( 1/0, 1 )", 90
ECHO: "atan2( 1/0,-1 )", 90
ECHO: "atan2(-1/0, 1 )", -90
ECHO: "atan2(-1/0,-1 )", -90
ECHO: "atan2( 1/0, 0 )", 90
ECHO: "atan2( 1/0,-0 )", 90
ECHO: "atan2(-1/0, 0 )", -90
ECHO: "atan2(-1/0,-0 )", -90
ECHO: "atan2( 1 , 1/0)", 0
ECHO: "atan2( 1 ,-1/0)", 180
ECHO: "atan2(-1 , 1/0)", 0
ECHO: "atan2(-1 ,-1/0)", -180
ECHO: "atan2( 0, 1/0)", 0
ECHO: "atan2( 0,-1/0)", 180
ECHO: "atan2( -0, 1/0)", 0
ECHO: "atan2( -0,-1/0)", -180
ECHO: "ceil( 0/ 0)", nan
ECHO: "ceil(-0/ 0)", nan
ECHO: "ceil( 0/-0)", nan
ECHO: "ceil(-0/-0)", nan
ECHO: "ceil( 1/ 0)", inf
ECHO: "ceil(-1/ 0)", -inf
ECHO: "ceil( 1/-0)", -inf
ECHO: "ceil(-1/-0)", inf
ECHO: "ceil( 0/ 1)", 0
ECHO: "ceil(-0/ 1)", 0
ECHO: "ceil( 0/-1)", 0
ECHO: "ceil(-0/-1)", 0
ECHO: "floor( 0/ 0)", nan
ECHO: "floor(-0/ 0)", nan
ECHO: "floor( 0/-0)", nan
ECHO: "floor(-0/-0)", nan
ECHO: "floor( 1/ 0)", inf
ECHO: "floor(-1/ 0)", -inf
ECHO: "floor( 1/-0)", -inf
ECHO: "floor(-1/-0)", inf
ECHO: "floor( 0/ 1)", 0
ECHO: "floor(-0/ 1)", 0
ECHO: "floor( 0/-1)", 0
ECHO: "floor(-0/-1)", 0
ECHO: "ln( 0/ 0)", nan
ECHO: "ln(-0/ 0)", nan
ECHO: "ln( 0/-0)", nan
ECHO: "ln(-0/-0)", nan
ECHO: "ln( 1/ 0)", inf
ECHO: "ln(-1/ 0)", nan
ECHO: "ln( 1/-0)", nan
ECHO: "ln(-1/-0)", inf
ECHO: "ln( 0/ 1)", -inf
ECHO: "ln(-0/ 1)", -inf
ECHO: "ln( 0/-1)", -inf
ECHO: "ln(-0/-1)", -inf
ECHO: "log( 0/ 0)", nan
ECHO: "log(-0/ 0)", nan
ECHO: "log( 0/-0)", nan
ECHO: "log(-0/-0)", nan
ECHO: "log( 1/ 0)", inf
ECHO: "log(-1/ 0)", nan
ECHO: "log( 1/-0)", nan
ECHO: "log(-1/-0)", inf
ECHO: "log( 0/ 1)", -inf
ECHO: "log(-0/ 1)", -inf
ECHO: "log( 0/-1)", -inf
ECHO: "log(-0/-1)", -inf
ECHO: "round( 0/ 0)", nan
ECHO: "round(-0/ 0)", nan
ECHO: "round( 0/-0)", nan
ECHO: "round(-0/-0)", nan
ECHO: "round( 1/ 0)", inf
ECHO: "round(-1/ 0)", -inf
ECHO: "round( 1/-0)", -inf
ECHO: "round(-1/-0)", inf
ECHO: "round( 0/ 1)", 0
ECHO: "round(-0/ 1)", 0
ECHO: "round( 0/-1)", 0
ECHO: "round(-0/-1)", 0
ECHO: "sign( 0/ 0)", 0
ECHO: "sign(-0/ 0)", 0
ECHO: "sign( 0/-0)", 0
ECHO: "sign(-0/-0)", 0
ECHO: "sign( 1/ 0)", 1
ECHO: "sign(-1/ 0)", -1
ECHO: "sign( 1/-0)", -1
ECHO: "sign(-1/-0)", 1
ECHO: "sign( 0/ 1)", 0
ECHO: "sign(-0/ 1)", 0
ECHO: "sign( 0/-1)", 0
ECHO: "sign(-0/-1)", 0
ECHO: "sqrt( 0/ 0)", nan
ECHO: "sqrt(-0/ 0)", nan
ECHO: "sqrt( 0/-0)", nan
ECHO: "sqrt(-0/-0)", nan
ECHO: "sqrt( 1/ 0)", inf
ECHO: "sqrt(-1/ 0)", nan
ECHO: "sqrt( 1/-0)", nan
ECHO: "sqrt(-1/-0)", inf
ECHO: "sqrt( 0/ 1)", 0
ECHO: "sqrt(-0/ 1)", 0
ECHO: "sqrt( 0/-1)", 0
ECHO: "sqrt(-0/-1)", 0
ECHO: "pow(2, 0/ 0)", nan
ECHO: "pow(2,-0/ 0)", nan
ECHO: "pow(2, 0/-0)", nan
ECHO: "pow(2,-0/-0)", nan
ECHO: "pow(2, 1/ 0)", inf
ECHO: "pow(2,-1/ 0)", 0
ECHO: "pow(2, 1/-0)", 0
ECHO: "pow(2,-1/-0)", inf
ECHO: "pow(2, 0/ 1)", 1
ECHO: "pow(2,-0/ 1)", 1
ECHO: "pow(2, 0/-1)", 1
ECHO: "pow(2,-0/-1)", 1
ECHO: "exp(2, 0/ 0)", undef
ECHO: "exp(2,-0/ 0)", undef
ECHO: "exp(2, 0/-0)", undef
ECHO: "exp(2,-0/-0)", undef
ECHO: "exp(2, 1/ 0)", undef
ECHO: "exp(2,-1/ 0)", undef
ECHO: "exp(2, 1/-0)", undef
ECHO: "exp(2,-1/-0)", undef
ECHO: "exp(2, 0/ 1)", undef
ECHO: "exp(2,-0/ 1)", undef
ECHO: "exp(2, 0/-1)", undef
ECHO: "exp(2,-0/-1)", undef
ECHO: "max( 0, 0)", 0
ECHO: "max( -0, 0)", 0
ECHO: "max( 0, -0)", 0
ECHO: "max( -0, -0)", 0
ECHO: "max( 0, 1)", 1
ECHO: "max( 0, -1)", 0
ECHO: "max( 1, 0)", 1
ECHO: "max( -1, 0)", 0
ECHO: "max( -0, 1)", 1
ECHO: "max( -0, -1)", 0
ECHO: "max( 1, -0)", 1
ECHO: "max( -1, -0)", 0
ECHO: "max( 1/0, 1/0)", inf
ECHO: "max( 1/0,-1/0)", inf
ECHO: "max(-1/0, 1/0)", inf
ECHO: "max(-1/0,-1/0)", -inf
ECHO: "max( 1/0, 1 )", inf
ECHO: "max( 1/0,-1 )", inf
ECHO: "max(-1/0, 1 )", 1
ECHO: "max(-1/0,-1 )", -1
ECHO: "max( 1/0, 0 )", inf
ECHO: "max( 1/0,-0 )", inf
ECHO: "max(-1/0, 0 )", 0
ECHO: "max(-1/0,-0 )", 0
ECHO: "max( 1 , 1/0)", inf
ECHO: "max( 1 ,-1/0)", 1
ECHO: "max(-1 , 1/0)", inf
ECHO: "max(-1 ,-1/0)", -1
ECHO: "max( 0, 1/0)", inf
ECHO: "max( 0,-1/0)", 0
ECHO: "max( -0, 1/0)", inf
ECHO: "max( -0,-1/0)", 0
ECHO: "min( 0, 0)", 0
ECHO: "min( -0, 0)", 0
ECHO: "min( 0, -0)", 0
ECHO: "min( -0, -0)", 0
ECHO: "min( 0, 1)", 0
ECHO: "min( 0, -1)", -1
ECHO: "min( 1, 0)", 0
ECHO: "min( -1, 0)", -1
ECHO: "min( -0, 1)", 0
ECHO: "min( -0, -1)", -1
ECHO: "min( 1, -0)", 0
ECHO: "min( -1, -0)", -1
ECHO: "min( 1/0, 1/0)", inf
ECHO: "min( 1/0,-1/0)", -inf
ECHO: "min(-1/0, 1/0)", -inf
ECHO: "min(-1/0,-1/0)", -inf
ECHO: "min( 1/0, 1 )", 1
ECHO: "min( 1/0,-1 )", -1
ECHO: "min(-1/0, 1 )", -inf
ECHO: "min(-1/0,-1 )", -inf
ECHO: "min( 1/0, 0 )", 0
ECHO: "min( 1/0,-0 )", 0
ECHO: "min(-1/0, 0 )", -inf
ECHO: "min(-1/0,-0 )", -inf
ECHO: "min( 1 , 1/0)", 1
ECHO: "min( 1 ,-1/0)", -inf
ECHO: "min(-1 , 1/0)", -1
ECHO: "min(-1 ,-1/0)", -inf
ECHO: "min( 0, 1/0)", 0
ECHO: "min( 0,-1/0)", -inf
ECHO: "min( -0, 1/0)", 0
ECHO: "min( -0,-1/0)", -inf

View file

@ -25,6 +25,7 @@ import getopt
import shutil import shutil
import platform import platform
import string import string
import difflib
def initialize_environment(): def initialize_environment():
if not options.generate: options.generate = bool(os.getenv("TEST_GENERATE")) if not options.generate: options.generate = bool(os.getenv("TEST_GENERATE"))
@ -54,6 +55,7 @@ def init_actual_filename():
def verify_test(testname, cmd): def verify_test(testname, cmd):
global expectedfilename global expectedfilename
if testname=='cgalstlsanitytest': return True # no expected file
if not options.generate: if not options.generate:
if not os.path.isfile(expectedfilename): if not os.path.isfile(expectedfilename):
print >> sys.stderr, "Error: test '%s' is missing expected output in %s" % (testname, expectedfilename) print >> sys.stderr, "Error: test '%s' is missing expected output in %s" % (testname, expectedfilename)
@ -89,9 +91,16 @@ def compare_default(resultfilename):
print >> sys.stderr, 'diff text compare: ' print >> sys.stderr, 'diff text compare: '
print >> sys.stderr, ' expected textfile: ', expectedfilename print >> sys.stderr, ' expected textfile: ', expectedfilename
print >> sys.stderr, ' actual textfile: ', resultfilename print >> sys.stderr, ' actual textfile: ', resultfilename
sys.stderr.flush()
if not compare_text(expectedfilename, resultfilename): if not compare_text(expectedfilename, resultfilename):
if resultfilename: if resultfilename:
execute_and_redirect("diff", [expectedfilename, resultfilename], sys.stderr) fromlines = open(expectedfilename,'r').readlines()
tolines = open(resultfilename,'r').readlines()
difftxt = difflib.unified_diff(fromlines,tolines)
for line in difftxt:
print >> sys.stderr, line,
sys.stderr.flush()
#execute_and_redirect("diff", [expectedfilename, resultfilename], sys.stderr)
return False return False
return True return True
@ -134,12 +143,17 @@ def compare_png(resultfilename):
return False return False
def compare_with_expected(resultfilename): def compare_with_expected(resultfilename):
if options.testname=='cgalstlsanitytest':
return True
if not options.generate: if not options.generate:
if "compare_" + options.suffix in globals(): return globals()["compare_" + options.suffix](resultfilename) if "compare_" + options.suffix in globals(): return globals()["compare_" + options.suffix](resultfilename)
else: return compare_default(resultfilename) else: return compare_default(resultfilename)
return True return True
def run_test(testname, cmd, args): def run_test(testname, cmd, args):
if testname=='cgalstlsanitytest':
return cgalstlsanitytest(scadfile=args[0],openscad_exec=cmd)
cmdname = os.path.split(options.cmd)[1] cmdname = os.path.split(options.cmd)[1]
if options.generate: if options.generate:
@ -154,7 +168,7 @@ def run_test(testname, cmd, args):
try: try:
cmdline = [cmd] + args + [outputname] cmdline = [cmd] + args + [outputname]
print cmdline print >> sys.stderr, 'Test cmdline:', cmdline
proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
errtext = proc.communicate()[1] errtext = proc.communicate()[1]
if errtext != None and len(errtext) > 0: if errtext != None and len(errtext) > 0:
@ -169,6 +183,32 @@ def run_test(testname, cmd, args):
print >> sys.stderr, "Error: %s \"%s\"" % (err.strerror, cmd) print >> sys.stderr, "Error: %s \"%s\"" % (err.strerror, cmd)
return None return None
# Check the 'sanity' of the STL output generated from the given .scad file.
# If there is a 'nan' or 'inf' in the STL output, consider it a 'failure'
# and return None. If STL generation crashes or fails, or we cant read
# back the generated STL, also return None. Otherwise, return True.
def cgalstlsanitytest(scadfile,openscad_exec):
stlfile = scadfile + '.stl'
args = [openscad_exec, scadfile, '-o', stlfile]
try:
subprocess.check_call( args )
except:
print >> sys.stderr, "subprocess call failed. cmd:",args
return None
#f=open(stlfile,'w') #debug
#f.write('nan')
#f.close()
try:
result = open(stlfile).read()
except:
print >> sys.stderr, "open().read() call failed on file", stlfile
return None
os.unlink(stlfile)
if 'nan' in result or 'inf' in result:
print >> sys.stderr, "nan or inf in stl generated by:",args
return None
return True
class Options: class Options:
def __init__(self): def __init__(self):
self.__dict__['options'] = {} self.__dict__['options'] = {}

View file

@ -330,7 +330,7 @@ def to_html(project_name, startdate, tests, enddate, sysinfo, sysid, makefiles):
templates = Templates() templates = Templates()
for test in report_tests: for test in report_tests:
if test.type in ('txt', 'ast', 'csg', 'term', 'echo'): if test.type in ('txt', 'ast', 'csg', 'term', 'echo', 'stl'):
text_test_count += 1 text_test_count += 1
templates.add('text_template', 'text_tests', templates.add('text_template', 'text_tests',
test_name=test.fullname, test_name=test.fullname,
@ -442,8 +442,8 @@ def main():
builddir = ezsearch('--builddir=(.*?) ', ' '.join(sys.argv) + ' ') builddir = ezsearch('--builddir=(.*?) ', ' '.join(sys.argv) + ' ')
if not builddir or not os.path.exists(builddir): if not builddir or not os.path.exists(builddir):
builddir = os.getcwd() builddir = os.getcwd()
print 'warning: couldnt find --builddir, trying to use current dir:', debug('warning: couldnt find --builddir, trying to use current dir:')
print builddir debug(builddir)
debug('build dir set to ' + builddir) debug('build dir set to ' + builddir)
upload = False upload = False
@ -474,7 +474,7 @@ def main():
html_filename = os.path.join(builddir, 'Testing', 'Temporary', html_basename) html_filename = os.path.join(builddir, 'Testing', 'Temporary', html_basename)
debug('saving ' + html_filename + ' ' + str(len(html)) + ' bytes') debug('saving ' + html_filename + ' ' + str(len(html)) + ' bytes')
trysave(html_filename, html) trysave(html_filename, html)
print "report saved:\n", html_filename.replace(os.getcwd()+os.path.sep,'') print "report saved:\n", os.path.realpath(html_filename.replace(os.getcwd()+os.path.sep,''))
failed_tests = [test for test in tests if not test.passed] failed_tests = [test for test in tests if not test.passed]
if upload and failed_tests: if upload and failed_tests: