Make regression suite scripts work on posix as well.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@600 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-13 12:13:53 +00:00
parent 9fd2245eb1
commit 2d19e7cbbe
4 changed files with 611 additions and 601 deletions

View File

@ -68,9 +68,7 @@ def process_dir(d, outfile, file_filter):
outf = os.path.join(os.getcwd(), settings.database_name, outf = os.path.join(os.getcwd(), settings.database_name,
utils.hashing(fullp, pp)) utils.hashing(fullp, pp))
cmd = utils.assimp_bin_path + " dump \"" + fullp + \ cmd = [utils.assimp_bin_path,"dump",fullp,outf,"-b","-s",pp]
"\" " + outf + " -b -s " + pp
outfile.write("assimp dump "+"-"*80+"\n") outfile.write("assimp dump "+"-"*80+"\n")
outfile.flush() outfile.flush()
if subprocess.call(cmd, stdout=outfile, stderr=outfile, shell=False): if subprocess.call(cmd, stdout=outfile, stderr=outfile, shell=False):

View File

@ -178,8 +178,8 @@ def process_dir(d, outfile_results, zipin, result):
outfile_expect = mkoutputdir_andgetpath(fullpath, filehash, "EXPECT") outfile_expect = mkoutputdir_andgetpath(fullpath, filehash, "EXPECT")
outfile_results.write("assimp dump "+"-"*80+"\n") outfile_results.write("assimp dump "+"-"*80+"\n")
outfile_results.flush() outfile_results.flush()
command = utils.assimp_bin_path + " dump \"" + fullpath + \
"\" " + outfile_actual + " -b -s " + pppreset command = [utils.assimp_bin_path,"dump",fullpath,outfile_actual,"-b","-s",pppreset]
r = subprocess.call(command, **shellparams) r = subprocess.call(command, **shellparams)
if r and not failure: if r and not failure:
@ -202,13 +202,14 @@ def process_dir(d, outfile_results, zipin, result):
outfile_results.write("assimp cmpdump "+"-"*80+"\n") outfile_results.write("assimp cmpdump "+"-"*80+"\n")
outfile_results.flush() outfile_results.flush()
command = utils.assimp_bin_path + ' cmpdump "' + outfile_actual + '" "' \
+ outfile_expect + '"'
command = [utils.assimp_bin_path,'cmpdump',outfile_actual,outfile_expect]
if subprocess.call(command, **shellparams) != 0: if subprocess.call(command, **shellparams) != 0:
result.fail(fullpath, outfile_expect, pppreset, DATABASE_VALUE_MISMATCH) result.fail(fullpath, outfile_expect, pppreset, DATABASE_VALUE_MISMATCH)
continue continue
result.ok(fullpath, pppreset, COMPARE_SUCCESS, len(input_expected))
result.ok(fullpath, pppreset, COMPARE_SUCCESS,
len(input_expected))
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
def del_folder_with_contents(folder): def del_folder_with_contents(folder):

View File

@ -46,11 +46,20 @@
def hashing(file,pp): def hashing(file,pp):
""" Map an input file and a postprocessing config to an unique hash. """ Map an input file and a postprocessing config to an unique hash.
The hash is used to store the item in the database. The buildin The hash is used to store the item in the database. It
hash() function is used. The hash is a string. needs to be persistent across different python implementations
and platforms, so we implement the hashing manually.
""" """
return hex(hash(file+":"+pp))
def myhash(instring):
# sdbm hash
res = 0
for t in instring:
res = (ord(t) + (res<<6) + (res<<16) - res) % 2**32
os
return res
return hex(myhash(file.replace('\\','/')+":"+pp))
assimp_bin_path = None assimp_bin_path = None
@ -87,19 +96,21 @@ def find_assimp_or_die():
search = [os.path.join("..","..","bin","assimpcmd_release-dll_x64","assimp.exe"), search = [os.path.join("..","..","bin","assimpcmd_release-dll_x64","assimp.exe"),
os.path.join("..","..","bin","x64","assimp")] os.path.join("..","..","bin","x64","assimp")]
assimp_bin_path = locate_file(search)
if assimp_bin_path is None:
print("Can't locate assimp_cmd binary")
sys.exit(-5)
print("Located assimp/assimp_cmd binary at ",assimp_bin_path)
elif os.name == "posix": elif os.name == "posix":
search = [os.path.join("..","..","bin","gcc","assimp"), #search = [os.path.join("..","..","bin","gcc","assimp"),
os.path.join("/usr","local","bin")] # os.path.join("/usr","local","bin",'assimp')]
assimp_bin_path = "assimp"
print("Taking system-wide assimp binary")
else: else:
print("Unsupported operating system") print("Unsupported operating system")
sys.exit(-5) sys.exit(-5)
assimp_bin_path = locate_file(search)
if assimp_bin_path is None:
print("Can't locate assimp_cmd binary")
sys.exit(-5)
print("Located assimp/assimp_cmd binary at ",assimp_bin_path)
if __name__ == '__main__': if __name__ == '__main__':