Created
April 27, 2009 11:32
-
-
Save baoilleach/102445 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import subprocess | |
testprogram = """ | |
#include <openbabel/parsmart.h> | |
using namespace OpenBabel; | |
int main(int argc, char *argv[]) { | |
OBSmartsPattern tmp; | |
return 0; | |
} | |
""" | |
tests = [] | |
for header in glob.glob(os.path.join("..", "openbabel-2.2.1b3", "include", "openbabel", "*.h")): | |
input = open(header, "r") | |
for line in input: | |
if line.find("class OBAPI") >= 0: | |
tests.append((header.split("/")[-1], line.split()[2].replace(":", ""))) | |
problems = [] | |
for test in tests: | |
thistest = testprogram.replace("OBSmartsPattern", test[1]).replace("parsmart.h", test[0]) | |
filename = "test%s.cpp" % test[1] | |
output = open(filename, "w") | |
print >> output, "#include <openbabel/mol.h>" | |
print >> output, thistest | |
output.close() | |
retcode = subprocess.call("g++ -L/home/demo/work/tree/lib -lopenbabel -I/home/demo/work/openbabel-2.2.1b3/include %s" % filename, shell=True) | |
if retcode == 0: | |
output = open(filename, "w") | |
print >> output, thistest | |
output.close() | |
retcode = subprocess.call("g++ -L/home/demo/work/tree/lib -lopenbabel -I/home/demo/work/openbabel-2.2.1b3/include %s" % filename, shell=True) | |
if retcode != 0: | |
problems.append(test) | |
print "\n\n", problems | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment