2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-27 07:02:15 +00:00

- Added unittests for linux

[SVN r18065]
This commit is contained in:
Bruno da Silva de Oliveira
2003-03-23 18:23:09 +00:00
parent fa27bddfab
commit f9bf514801
3 changed files with 55 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ struct C
}
operator int() const
{
return value;
return (int)value;
}
double operator()()

View File

@@ -11,7 +11,7 @@ template <class T>
list VectorToList(const std::vector<T> & v)
{
list res;
std::vector<T>::const_iterator it;
typename std::vector<T>::const_iterator it;
for(it = v.begin(); it != v.end(); ++it){
res.append(*it);
}

View File

@@ -0,0 +1,53 @@
#!/usr/bin/python
import os
import glob
def build_pyste_files():
# list all pyste files in the example directory
examples = glob.glob('../example/*.pyste')
# generate the cpp file for each example
for example in examples:
path, filename = os.path.split(example)
module = os.path.splitext(filename)[0]
os.system('python ../src/pyste.py -I%s --module=%s %s' % (path, module, example))
def compile_pyste_files():
# list all cpp files in this directory
cpps = glob.glob('*.cpp')
# compile each cpp into a shared library
for cpp in cpps:
print
print 'compiling', cpp
out = os.path.splitext(cpp)[0] + '.so'
cmdline = 'g++ -shared -o %s -I../example ' \
'-I/usr/include/python2.2 -lboost_python %s' % (out, cpp)
os.system(cmdline)
def run_tests():
if os.system('python runtests.py') != 0:
raise RuntimeError, 'tests failed'
def cleanup():
extensions = '*.cpp *.so *.pyc'
files = []
for ext in extensions.split():
files += glob.glob(ext)
for file in files:
os.remove(file)
def main():
build_pyste_files()
compile_pyste_files()
run_tests()
cleanup()
if __name__ == '__main__':
try:
main()
except RuntimeError, e:
print e