Add a tiny test script to load all files in a test directory using one importer instance repeatedly.

Fix importer unit test, wasn't yet migrated to DeadlyImportError's.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@626 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-23 18:26:48 +00:00
parent 63d6ca8669
commit 24edb60955
4 changed files with 68 additions and 44 deletions

View File

@ -1,41 +0,0 @@
rem Alexander Gessler, 12:30:08
set errorlevel=0
color 4e
cls
@echo off
rem
SET ARCHEXT=x64
IF %PROCESSOR_ARCHITECTURE% == x86 SET ARCHEXT=win32
SET OUTDIR=results\
SET BINDIR=..\bin\
echo #=====================================================================
echo # Open Asset Import Library - Unit & Regression test suite
echo #=====================================================================
echo #
echo # Executing the Assimp unit & regression test suites for the
echo # following build configurations.
echo #
echo # Release
echo # Release -st
echo # Release -noboost
echo # Release -dll
echo #
echo # Debug
echo # Debug -st
echo # Debug -noboost
echo # Debug -dll
echo ======================================================================
echo.
echo.
call RunUnitTestSuite.bat

View File

@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""Read all test files for a particular file format using a single
importer instance. Read them again in reversed order. This is used
to verify that a loader does proper cleanup and can be called
repeatedly."""
import sys
import os
import subprocess
# hack-load utils.py and settings.py from ../regression
sys.path.append(os.path.join('..','regression'))
import utils
import settings
def process_dir(thisdir):
"""Process /thisdir/ recursively"""
res = []
shellparams = {'stdin':subprocess.PIPE,'stdout':sys.stdout,'shell':True}
command = [utils.assimp_bin_path,"testbatchload"]
for f in os.listdir(thisdir):
if os.path.splitext(f)[-1] in settings.exclude_extensions:
continue
fullpath = os.path.join(thisdir, f)
if os.path.isdir(fullpath):
if f != ".svn":
res += process_dir(fullpath)
continue
command.append(fullpath)
if len(command)>2:
# testbatchload returns always 0 if more than one file in the list worked.
# however, if it should segfault, the OS will return something not 0.
command += reversed(command[2:])
if subprocess.call(command, **shellparams):
res.append(thisdir)
return res
def main():
"""Run the test on all registered test repositories"""
utils.find_assimp_or_die()
res = []
for tp in settings.model_directories:
res += process_dir(tp)
[print(f) for f in res]
return 0
if __name__ == '__main__':
res = main()
input('All done, waiting for keystroke ')
sys.exit(res)
# vim: ai ts=4 sts=4 et sw=4

View File

@ -50,7 +50,7 @@ import os
# List of file extensions to be excluded from the regression suite # List of file extensions to be excluded from the regression suite
# File extensions are case insensitive # File extensions are case insensitive
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
exclude_extensions = [".lws",".assbin",".assxml"] exclude_extensions = [".lws",".assbin",".assxml",".txt",".jpeg",".jpg",".png",".gif",".tga",".bmp"]
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# Post processing configurations to be included in the test. The # Post processing configurations to be included in the test. The

View File

@ -153,9 +153,9 @@ void ImporterTest :: testPluginInterface (void)
try { try {
p->InternReadFile("",0,NULL); p->InternReadFile("",0,NULL);
} }
catch ( ImportErrorException* ex) catch ( const DeadlyImportError& dead)
{ {
CPPUNIT_ASSERT(ex->GetErrorText() == AIUT_DEF_ERROR_TEXT); CPPUNIT_ASSERT(!strcmp(dead.what(),AIUT_DEF_ERROR_TEXT));
// unregister the plugin and delete it // unregister the plugin and delete it
pImp->UnregisterLoader(p); pImp->UnregisterLoader(p);