import inspect, os, commands

where = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
build_dir = os.getenv('RETHINKDB_BUILD_DIR') or os.path.join(where, '../../build/debug/')
unit_exec = os.path.join(build_dir, 'rethinkdb-unittest')

list = commands.getoutput(unit_exec + " --gtest_list_tests | grep '\.$'")
list = list.split('\n')
list = [t[:-1] for t in list]

for test in list:
    generate_test(
        "%s --gtest_filter='%s.*'" % (unit_exec, test),
        name = test
        )
