summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt11
-rw-r--r--tests/CTestCustom.template4
-rw-r--r--tests/csgtestcore.cc212
-rw-r--r--tests/csgtestcore.h12
-rw-r--r--tests/regression/cgalpngtest/resize-2d-tests-expected.pngbin2436 -> 2451 bytes
-rw-r--r--tests/regression/cgalpngtest/resize-tests-expected.pngbin4422 -> 4786 bytes
-rw-r--r--tests/regression/dumptest/resize-2d-tests-expected.csg50
-rw-r--r--tests/regression/dumptest/resize-tests-expected.csg44
-rw-r--r--tests/regression/echotest/rands-expected.txt3
-rw-r--r--tests/regression/opencsgtest/resize-2d-tests-expected.pngbin3317 -> 3429 bytes
-rw-r--r--tests/regression/opencsgtest/resize-tests-expected.pngbin5106 -> 5616 bytes
-rw-r--r--tests/regression/throwntogethertest/resize-2d-tests-expected.pngbin3277 -> 3432 bytes
-rw-r--r--tests/regression/throwntogethertest/resize-tests-expected.pngbin5116 -> 5616 bytes
-rw-r--r--tests/test_pretty_print.cc2
-rwxr-xr-xtests/test_upload.py307
-rw-r--r--tests/throwntogethertest.cc5
16 files changed, 95 insertions, 555 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 79a285e..1845ef5 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -541,14 +541,6 @@ set_target_properties(cgalcachetest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CG
target_link_libraries(cgalcachetest tests-cgal ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
#
-# throwntogethertest
-#
-
-add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/renderer.cc ../src/rendersettings.cc)
-set_target_properties(throwntogethertest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
-target_link_libraries(throwntogethertest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY})
-
-#
# GUI binary tests
#
if(APPLE)
@@ -836,6 +828,7 @@ string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TM
string(REPLACE __python__ ${PYTHON_EXECUTABLE} 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 __gui_binpath__ ${GUI_BINPATH} TMP ${TMP})
if (MINGW_CROSS_ENV_DIR)
string(REPLACE __wine__ wine TMP ${TMP})
@@ -864,7 +857,7 @@ add_cmdline_test(csgtermtest EXE ${GUI_BINPATH} ARGS -o SUFFIX term FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad)
add_cmdline_test(cgalpngtest EXE ${GUI_BINPATH} ARGS --render -o SUFFIX png FILES ${CGALPNGTEST_FILES})
add_cmdline_test(opencsgtest EXE ${GUI_BINPATH} ARGS -o SUFFIX png FILES ${OPENCSGTEST_FILES})
-add_cmdline_test(throwntogethertest SUFFIX png FILES ${THROWNTOGETHERTEST_FILES})
+add_cmdline_test(throwntogethertest EXE ${GUI_BINPATH} ARGS --preview=throwntogether -o SUFFIX png FILES ${THROWNTOGETHERTEST_FILES})
# FIXME: We don't actually need to compare the output of cgalstlsanitytest
# with anything. It's self-contained and returns != 0 on error
add_cmdline_test(cgalstlsanitytest EXE ${CMAKE_SOURCE_DIR}/cgalstlsanitytest SUFFIX txt ARGS ${GUI_BINPATH} FILES ${CGALSTLSANITYTEST_FILES})
diff --git a/tests/CTestCustom.template b/tests/CTestCustom.template
index fd6ba8b..b8d04ce 100644
--- a/tests/CTestCustom.template
+++ b/tests/CTestCustom.template
@@ -58,8 +58,8 @@ endif()
# Part 1. Pretty Printing
-message("running 'opencsgtest --info' to generate sysinfo.txt")
-execute_process(COMMAND __wine__ __cmake_current_binary_dir__/opencsgtest --info OUTPUT_FILE sysinfo.txt)
+message("running '__gui_binpath__ --info' to generate sysinfo.txt")
+execute_process(COMMAND __wine__ __gui_binpath__ --info OUTPUT_FILE sysinfo.txt)
set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__cmake_current_binary_dir__/test_pretty_print")
if ( ${debug_openscad_template} )
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc
deleted file mode 100644
index 7b9dbab..0000000
--- a/tests/csgtestcore.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-// csg test core, used by throwntegether test and opencsg test
-#include "csgtestcore.h"
-
-#include "tests-common.h"
-#include "system-gl.h"
-#include "openscad.h"
-#include "parsersettings.h"
-#include "builtin.h"
-#include "modcontext.h"
-#include "node.h"
-#include "module.h"
-#include "polyset.h"
-#include "Tree.h"
-#include "CSGTermEvaluator.h"
-#include "CGALEvaluator.h"
-#include "PolySetCGALEvaluator.h"
-
-#include <opencsg.h>
-#include "OpenCSGRenderer.h"
-#include "ThrownTogetherRenderer.h"
-
-#include "csgterm.h"
-#include "csgtermnormalizer.h"
-#include "OffscreenView.h"
-
-#include <sstream>
-#include <vector>
-
-#include <boost/program_options.hpp>
-#include <boost/filesystem.hpp>
-
-#include "CsgInfo.h"
-
-namespace po = boost::program_options;
-namespace fs = boost::filesystem;
-#include "boosty.h"
-
-using std::string;
-using std::vector;
-using std::cerr;
-using std::cout;
-
-std::string commandline_commands;
-
-//#define DEBUG
-
-string info_dump(OffscreenView *glview)
-{
- assert(glview);
-
-#ifdef __GNUG__
-#define compiler_info "GCC " << __VERSION__
-#elif defined(_MSC_VER)
-#define compiler_info "MSVC " << _MSC_FULL_VER
-#else
-#define compiler_info "unknown compiler"
-#endif
-
-#ifndef OPENCSG_VERSION_STRING
-#define OPENCSG_VERSION_STRING "unknown, <1.3.2"
-#endif
-
- std::stringstream out;
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
- out << "\nOpenSCAD Version: " << TOSTRING(OPENSCAD_VERSION)
- << "\nCompiled by: " << compiler_info
- << "\nCompile date: " << __DATE__
- << "\nBoost version: " << BOOST_LIB_VERSION
- << "\nEigen version: " << EIGEN_WORLD_VERSION << "."
- << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION
- << "\nCGAL version: " << TOSTRING(CGAL_VERSION)
- << "\nOpenCSG version: " << OPENCSG_VERSION_STRING
- << "\n" << glview->getRendererInfo()
- << "\n";
-
- return out.str();
-}
-
-po::variables_map parse_options(int argc, char *argv[])
-{
- po::options_description desc("Allowed options");
- desc.add_options()
- ("help,h", "help message")//;
- ("info,i", "information on GLEW, OpenGL, OpenSCAD, and OS")//;
-
-// po::options_description hidden("Hidden options");
-// hidden.add_options()
- ("input-file", po::value< vector<string> >(), "input file")
- ("output-file", po::value< vector<string> >(), "output file");
-
- po::positional_options_description p;
- p.add("input-file", 1).add("output-file", 1);
-
- po::options_description all_options;
- all_options.add(desc); // .add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
- po::notify(vm);
-
- return vm;
-}
-
-int csgtestcore(int argc, char *argv[], test_type_e test_type)
-{
- bool sysinfo_dump = false;
- const char *filename, *outfilename = NULL;
- po::variables_map vm;
- try {
- vm = parse_options(argc, argv);
- } catch ( po::error e ) {
- cerr << "error parsing options\n";
- }
- if (vm.count("info")) sysinfo_dump = true;
- if (vm.count("input-file"))
- filename = vm["input-file"].as< vector<string> >().begin()->c_str();
- if (vm.count("output-file"))
- outfilename = vm["output-file"].as< vector<string> >().begin()->c_str();
-
- if ((!filename || !outfilename) && !sysinfo_dump) {
- cerr << "Usage: " << argv[0] << " <file.scad> <output.png>\n";
- exit(1);
- }
-
- Builtins::instance()->initialize();
-
- fs::path original_path = fs::current_path();
-
- std::string currentdir = boosty::stringy( fs::current_path() );
-
- parser_init(boosty::stringy(fs::path(argv[0]).branch_path()));
- add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries"));
-
- ModuleContext top_ctx;
- top_ctx.registerBuiltin();
-
- FileModule *root_module;
- ModuleInstantiation root_inst("group");
-
- if (sysinfo_dump)
- root_module = parse("sphere();","",false);
- else
- root_module = parsefile(filename);
-
- if (!root_module) {
- exit(1);
- }
-
- if (!sysinfo_dump) {
- fs::path fpath = boosty::absolute(fs::path(filename));
- fs::path fparent = fpath.parent_path();
- fs::current_path(fparent);
- top_ctx.setDocumentPath(fparent.string());
- }
-
- AbstractNode::resetIndexCounter();
- AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst);
- AbstractNode *root_node;
- // Do we have an explicit root node (! modifier)?
- if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node;
-
- Tree tree(root_node);
-
- CsgInfo csgInfo = CsgInfo();
- if ( !csgInfo.compile_chains( tree ) ) return 1;
-
- fs::current_path(original_path);
-
- try {
- csgInfo.glview = new OffscreenView(512,512);
- } catch (int error) {
- fprintf(stderr,"Can't create OpenGL OffscreenView. Code: %i. Exiting.\n", error);
- exit(1);
- }
-
- if (sysinfo_dump) cout << info_dump(csgInfo.glview);
- Camera camera(Camera::VECTOR);
- camera.center << 0,0,0;
- double radius = 1.0;
-
- if (csgInfo.root_chain) {
- BoundingBox bbox = csgInfo.root_chain->getBoundingBox();
- camera.center = (bbox.min() + bbox.max()) / 2;
- radius = (bbox.max() - bbox.min()).norm() / 2;
- }
- Vector3d cameradir(1, 1, -0.5);
- camera.eye = camera.center - radius*1.8*cameradir;
- csgInfo.glview->setCamera(camera);
-
- OpenCSGRenderer opencsgRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo);
- ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain);
-
- if (test_type == TEST_THROWNTOGETHER)
- csgInfo.glview->setRenderer(&thrownTogetherRenderer);
- else
- csgInfo.glview->setRenderer(&opencsgRenderer);
-
- OpenCSG::setContext(0);
- OpenCSG::setOption(OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject);
-
- csgInfo.glview->paintGL();
-
- if (outfilename) csgInfo.glview->save(outfilename);
-
- delete root_node;
- delete root_module;
-
- Builtins::instance(true);
-
- return 0;
-}
diff --git a/tests/csgtestcore.h b/tests/csgtestcore.h
deleted file mode 100644
index 330c894..0000000
--- a/tests/csgtestcore.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef CSGTESTCORE_H_
-#define CSGTESTCORE_H_
-
-enum test_type_e {
- TEST_THROWNTOGETHER,
- TEST_OPENCSG
-};
-
-int csgtestcore(int argc, char *argv[], test_type_e test_type);
-
-#endif
-
diff --git a/tests/regression/cgalpngtest/resize-2d-tests-expected.png b/tests/regression/cgalpngtest/resize-2d-tests-expected.png
index 44e9598..e764ac3 100644
--- a/tests/regression/cgalpngtest/resize-2d-tests-expected.png
+++ b/tests/regression/cgalpngtest/resize-2d-tests-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/resize-tests-expected.png b/tests/regression/cgalpngtest/resize-tests-expected.png
index 8f994bf..6a5bb32 100644
--- a/tests/regression/cgalpngtest/resize-tests-expected.png
+++ b/tests/regression/cgalpngtest/resize-tests-expected.png
Binary files differ
diff --git a/tests/regression/dumptest/resize-2d-tests-expected.csg b/tests/regression/dumptest/resize-2d-tests-expected.csg
index 5f8d8b5..5cd9a2e 100644
--- a/tests/regression/dumptest/resize-2d-tests-expected.csg
+++ b/tests/regression/dumptest/resize-2d-tests-expected.csg
@@ -173,4 +173,54 @@ group() {
}
}
}
+ color([0, 0, 1, 1]) {
+ multmatrix([[1, 0, 0, -16], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [10,8,0], auto = [0,1,0]) {
+ multmatrix([[0.5, 0, 0, 0], [0, 100, 0, 0], [0, 0, 20, 0], [0, 0, 0, 1]]) {
+ group() {
+ difference() {
+ square(size = [5, 5], center = false);
+ multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ square(size = [1, 1], center = false);
+ }
+ multmatrix([[1, 0, 0, 3], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ circle($fn = 10, $fa = 12, $fs = 2, r = 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ multmatrix([[1, 0, 0, 0], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [8,10,15], auto = [1,1,1]) {
+ multmatrix([[1000, 0, 0, 0], [0, 0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ difference() {
+ square(size = [5, 5], center = false);
+ multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ square(size = [1, 1], center = false);
+ }
+ multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ square(size = [1, 1], center = false);
+ }
+ }
+ }
+ }
+ }
+ }
+ multmatrix([[1, 0, 0, 16], [0, 1, 0, -16], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [10,8,15], auto = [0,0,0]) {
+ multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ difference() {
+ square(size = [5, 5], center = false);
+ multmatrix([[1, 0, 0, 0], [0, 1, 0, 2.5], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ square(size = [5, 1], center = false);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/tests/regression/dumptest/resize-tests-expected.csg b/tests/regression/dumptest/resize-tests-expected.csg
index 1e7888a..98fef74 100644
--- a/tests/regression/dumptest/resize-tests-expected.csg
+++ b/tests/regression/dumptest/resize-tests-expected.csg
@@ -237,35 +237,67 @@ group() {
}
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, -10], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [-5,0,0], auto = [0,0,0]) {
cube(size = [1, 1, 1], center = false);
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 20], [0, 0, 1, -10], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [-5,0,0], auto = [0,0,0]) {
cube(size = [1, 1, 1], center = false);
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 30], [0, 0, 1, -10], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [0,0,0], auto = [0,0,0]) {
cube(size = [1, 1, 1], center = false);
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 40], [0, 0, 1, -10], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [0,0,0], auto = [0,0,0]) {
cube(size = [1, 1, 1], center = false);
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 50], [0, 0, 1, -10], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
resize(newsize = [0.5,0,7], auto = [0,0,0]) {
cube(size = [0.5, 1, 1000], center = false);
}
}
- multmatrix([[1, 0, 0, 10], [0, 1, 0, 60], [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]) {
cube(size = [6, 6, 1e+10], center = false);
}
}
}
+ color([0, 1, 0, 1]) {
+ multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [5,0,0], auto = [1,1,0]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [6,0,0], auto = [1,1,1]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [6,0,0], auto = [1,0,1]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [5,0,20], auto = [0,1,1]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [0,0,7], auto = [0,0,1]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ multmatrix([[1, 0, 0, 70], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ resize(newsize = [6,0,0], auto = [1,1,0]) {
+ cube(size = [9, 9, 9], center = false);
+ }
+ }
+ }
}
diff --git a/tests/regression/echotest/rands-expected.txt b/tests/regression/echotest/rands-expected.txt
new file mode 100644
index 0000000..36ac6cd
--- /dev/null
+++ b/tests/regression/echotest/rands-expected.txt
@@ -0,0 +1,3 @@
+WARNING: Ignoring unknown variable 'v'.
+ECHO: "i hope rands() did not crash"
+ECHO: [1, 1, 1, 1]
diff --git a/tests/regression/opencsgtest/resize-2d-tests-expected.png b/tests/regression/opencsgtest/resize-2d-tests-expected.png
index d3bda96..83a1ca7 100644
--- a/tests/regression/opencsgtest/resize-2d-tests-expected.png
+++ b/tests/regression/opencsgtest/resize-2d-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/resize-tests-expected.png b/tests/regression/opencsgtest/resize-tests-expected.png
index 0334ba6..669835d 100644
--- a/tests/regression/opencsgtest/resize-tests-expected.png
+++ b/tests/regression/opencsgtest/resize-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/resize-2d-tests-expected.png b/tests/regression/throwntogethertest/resize-2d-tests-expected.png
index 4737cf7..6c55fa9 100644
--- a/tests/regression/throwntogethertest/resize-2d-tests-expected.png
+++ b/tests/regression/throwntogethertest/resize-2d-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/resize-tests-expected.png b/tests/regression/throwntogethertest/resize-tests-expected.png
index 7445c1c..669835d 100644
--- a/tests/regression/throwntogethertest/resize-tests-expected.png
+++ b/tests/regression/throwntogethertest/resize-tests-expected.png
Binary files differ
diff --git a/tests/test_pretty_print.cc b/tests/test_pretty_print.cc
index 227d8ad..b07bab5 100644
--- a/tests/test_pretty_print.cc
+++ b/tests/test_pretty_print.cc
@@ -7,7 +7,6 @@
#include <cstddef>
#include <unistd.h>
-//#include <stdio.h>
#define PREQUOTE(x) #x
#define QUOTE(x) PREQUOTE(x)
@@ -18,7 +17,6 @@ int main( int argc, char * argv[] )
newargs[1] = const_cast<char *>(QUOTE( PYSRC ));
newargs[2] = const_cast<char *>(QUOTE( BUILDDIR ));
newargs[3] = NULL;
- //printf(":%s:%s:%s\n", newargs[0], newargs[1], newargs[2]);
return execv( newargs[0], newargs );
}
diff --git a/tests/test_upload.py b/tests/test_upload.py
deleted file mode 100755
index 59f4334..0000000
--- a/tests/test_upload.py
+++ /dev/null
@@ -1,307 +0,0 @@
-#!/usr/bin/python
-
-# test_upload.py copyright 2013 Don Bright <hugh.m.bright@gmail.com>
-# released under Zlib-style license:
-#
-# This software is provided 'as-is', without any express or implied
-# warranty. In no event will the authors be held liable for any damages
-# arising from the use of this software.
-#
-# Permission is granted to anyone to use this software for any purpose,
-# including commercial applications, and to alter it and redistribute it
-# freely, subject to the following restrictions:
-#
-# 1. The origin of this software must not be misrepresented; you must
-# not claim that you wrote the original software. If you use this
-# software in a product, an acknowledgment in the product documentation
-# would be appreciated but is not required.
-# 2. Altered source versions must be plainly marked as such, and must
-# not be misrepresented as being the original software. 3. This notice
-# may not be removed or altered from any source distribution.
-#
-# This license is based on zlib license by Jean-loup Gailly and Mark Adler
-
-
-# This script takes html output by test_pretty_print.py and uploads it
-# to a web server into an 'openscad_tests' subdir over ssh using sftp.
-# It then modifies the 'index.html' file in that directory to 'add to
-# the list' of reports on the remote web server.
-
-
-#
-# Design
-#
-# On the remote web server there is a directory called 'openscad_tests'
-# Inside of it is a file, 'index.html', that lists all the test reports
-# stored in that directory.
-#
-# This script uploads the last report created by test_pretty_print.py
-# Then it modifies the remote index.html file (if necessary) to display
-# a link to the new test report.
-#
-# Each test report is a single .html file, with all of the .png images
-# encoded directly into the file using the Data URI and base64 encoding.
-# The name of the report file is something like OS_cpu_GLinfo_hash.html, like
-# linux_x86_radeon_abcd.html
-#
-# See examples under 'usage()' below.
-#
-# Requirements for remote web server and local system:
-#
-# 1. Local system must have sftp access to remote server
-# This can be tested by runnig this: sftp user@remotehost
-# If you are using ssh-agent or an ssh-keyring it will go automatically.
-# Otherwise it will request your password to be typed in.
-#
-# 2. Remote web server only needs static html. There is no requirement
-# for php/cgi/etc.
-#
-# 3. Local system must have the python Paramiko library installed,
-# which in turn requires pycript to also be installed. (to PYTHONPATH)
-#
-# This script returns '1' on failure, '0' on success (shell-style)
-#
-
-# todo: support plain old ftp ??
-# todo: support new-fangled sites like dropbox ??
-
-import sys,os,platform,string,getpass
-
-try:
- import paramiko
-except:
- x='''
-please install the paramiko python library in your PYTHONPATH
-If that is not feasible, you can upload the single html report
-file by hand to any site that accepts html code.
-'''
-
-from test_pretty_print import ezsearch, read_sysinfo
-from test_cmdline_tool import execute_and_redirect
-
-debug_test_upload = False
-dryrun = False
-bytecount = 0
-
-def help():
- text='''
-test_upload.py
-
-usage:
-
- test_upload.py --username=uname --host=host --remotepath=/some/path \
- [--dryrun] [--debug]
-
-example1:
-
- $ ctest # result is Testing/Temporary/linux_x86_nvidia_report_abcd.html
- $ test_upload.py --username=andreis --host=web.sourceforge.net --remotepath=/home/project-web/projectxyz/htdocs/
- $ firefox http://projectxyz.sourceforge.net/openscad_tests/index.html
- # this should display a page with a link to show the test results
-
-example2:
-
- $ # run under X11, then run under Xvfb, upload both reports to one site
- $ ctest # X11 - result is Testing/Temporary/freebsd_x86_nvidia_abc_report.html
- $ test_upload.py --username=annag --host=fontanka.org --remotepath=/var/www/
- $ export DISPLAY= # dont use 'display' X, use Xvfb (different drivers)
- $ ctest # XVfb - result is Testing/Temporary/freebsd_x86_mesa_xyz_report.html
- $ test_upload.py --username=annag --host=fontanka.org --remotepath=/var/www/
- $ firefox http://fontanka.org/openscad_tests/index.html
- # result is 'index.html' with a link to the two separate test .html files
-
-'''
- print text
-
-
-def debug(x):
- if debug_test_upload:
- print 'test_upload.py:', x
- sys.stdout.flush()
-
-
-blankchunk='''<!-- __entry__ -->'''
-
-index_template='''
-<html>
-<head>
-OpenSCAD regression test results
-</head>
-<body>
- <h3>
- OpenSCAD regression test results
- </h3>
- <ul>
-''' + blankchunk + '''
- </ul>
-</body>
-</html>
-'''
-
-entry_template='''
- <li><a href="__href__">__rept_name__</a></li>
-'''
-
-
-def paramiko_upload( newrept_fname, username, host, remotepath ):
- global bytecount
- debug("running paramiko upload")
-
- basepath = 'openscad_tests'
- newrept_basefname = os.path.basename( newrept_fname )
- newrept_name = string.split( newrept_basefname,'.html')[0]
- debug("local file: "+ newrept_fname )
- debug("base filename: "+ newrept_basefname )
- debug("report name: "+ newrept_name )
-
-
-
- debug("connect to " + username + "@" + host)
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy)
- client.load_system_host_keys()
- if dryrun:
- debug("dryrun: no client.connect()")
- return 0
- try:
- client.connect(host,username=username)
- except paramiko.PasswordRequiredException, e:
- passw = getpass.getpass('enter passphrase for private ssh key: ')
- client.connect(host,username=username,password=passw)
-
- #stdin,stdout,stderr=client.exec_command('ls -l')
-
-
-
- debug("find remote path: " + remotepath)
- ftp = client.open_sftp()
- try:
- ftp.chdir( remotepath )
- except:
- debug("failed to change dir to remote path: "+remotepath)
- return 1
- debug("find basepath ( or create ):" + basepath )
- if not basepath in ftp.listdir():
- ftp.mkdir( basepath )
- ftp.chdir( basepath )
-
-
-
- debug("upload local report file to remote file:")
- debug(" local:"+newrept_fname)
- localf = open( newrept_fname, 'r' )
- rept_text = localf.read()
- localf.close()
- debug(" bytes read:"+str(len(rept_text)))
-
- debug("remote:"+os.path.join(ftp.getcwd(),newrept_basefname))
- f = ftp.file( newrept_basefname, 'w+' )
- f.write( rept_text )
- f.close()
- bytecount += len(rept_text)
-
-
- debug( "file uploaded. now, update index.html (or create blank) ")
-
- if not 'index.html' in ftp.listdir():
- f = ftp.file( 'index.html', 'w+')
- f.write(index_template)
- f.close()
- bytecount += len(index_template)
-
- f = ftp.file( 'index.html', 'r' )
- text = f.read()
- f.close()
-
- text2 = entry_template
- text2 = text2.replace( '__href__', newrept_basefname )
- text2 = text2.replace( '__rept_name__', newrept_name )
-
- if newrept_basefname in text:
- debug( newrept_basefname + " already linked from index.html")
- else:
- debug("add new report link to index.html")
- text = text.replace( blankchunk, blankchunk+'\n'+text2 )
-
- f = ftp.file( 'index.html', 'w+' )
- f.write(text)
- f.close()
- bytecount += len(text)
-
- debug("close connections")
- ftp.close()
- client.close()
- return 0
-
-def upload_unix( reptfile, username, host, remotepath):
- debug("detected unix-like system.")
- return paramiko_upload( reptfile, username, host, remotepath )
-
-def upload_darwin( reptfile, username, host, remotepath ):
- debug("detected osx/darwin")
- return upload_unix( reptfile, username, host, remotepath )
-
-def upload_windows( reptfile, username, host, remotepath ):
- debug("detected windows")
- print 'sorry, not implemented on windows'
- return 1
- # use pycript and paramiko
- # the problem is downloading them and installing them
-
-def upload( reptfile, username, host, remotepath ):
- sysname = platform.system().lower()
- result = 1
- if 'linux' in sysname or 'bsd' in sysname:
- result = upload_unix( reptfile, username, host, remotepath )
- elif 'darwin' in sysname:
- result = upload_darwin( reptfile, username, host, remotepath )
- elif 'windows' in platform.system():
- result = upload_windows( reptfile, username, host, remotepath )
- else:
- print "unknown system type. cant upload, sorry"
- return result
-
-def main():
- if '--debug' in string.join(sys.argv):
- global debug_test_upload
- debug_test_upload = True
- if '--dryrun' in string.join(sys.argv):
- global dryrun
- dryrun = True
-
- debug('running test_upload')
- debug('args: '+str(sys.argv[1:]))
-
- builddir = ezsearch('--builddir=(.*?) ',string.join(sys.argv)+' ')
- if builddir=='': builddir=os.getcwd()
- sysinfo, sysid = read_sysinfo(os.path.join(builddir,'sysinfo.txt'))
- debug("sysinfo: " + sysinfo[0:60].replace('\n','') + ". . . ")
- debug("sysid: " + sysid )
- if len(sysid)<6:
- print "unable to find valid system id"
- sys.exit(1)
-
- rept_basename = sysid + '_report' + '.html'
- rept_fname = os.path.join(builddir,'Testing','Temporary',rept_basename )
- debug("report filename:\n" + rept_fname )
-
- username = ezsearch('--username=(.*?) ',string.join(sys.argv)+' ')
- host = ezsearch('--host=(.*?) ',string.join(sys.argv)+' ')
- remotepath = ezsearch('--remotepath=(.*?) ',string.join(sys.argv)+' ')
-
- if rept_fname=='' or username=='' or host=='' or remotepath=='':
- help()
- sys.exit(1)
-
- res = upload( rept_fname, username, host, remotepath )
- if res==1:
- print "upload failed"
- return 1
- else:
- print "upload complete:", bytecount, "bytes written"
- return 0
-
-
-if __name__ == '__main__':
- sys.exit(main())
-
diff --git a/tests/throwntogethertest.cc b/tests/throwntogethertest.cc
deleted file mode 100644
index 5a4f14f..0000000
--- a/tests/throwntogethertest.cc
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "csgtestcore.h"
-
-int main(int argc, char* argv[]) {
- return csgtestcore(argc, argv, TEST_THROWNTOGETHER);
-}
contact: Jan Huwald // Impressum