def build_c_unit_tests(): """ Builds unit tests in C """ copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) make("code-experiments/test/unit-test", "clean", verbose=_build_verbosity) make("code-experiments/test/unit-test", "all", verbose=_build_verbosity)
def build_c_unit_tests(): """ Builds unit tests in C """ library_path = 'code-experiments/test/unit-test/lib' library_dir = '' file_name = '' if 'win32' in sys.platform: file_name = 'cmocka.dll' if '64' in platform.machine(): library_dir = 'win64' elif ('32' in platform.machine()) or ('x86' in platform.machine()): if 'cygwin' in os.environ['PATH']: library_dir = 'win32_cygwin' else: library_dir = 'win32_mingw' elif 'linux' in sys.platform: file_name = 'libcmocka.so' if 'Ubuntu' in platform.linux_distribution(): library_dir = 'linux_ubuntu' elif 'Fedora' in platform.linux_distribution(): library_dir = 'linux_fedora' elif 'darwin' in sys.platform: # Mac library_dir = 'macosx' file_name = 'libcmocka.dylib' if len(library_dir) > 0: copy_file(os.path.join(library_path, library_dir, file_name), os.path.join('code-experiments/test/unit-test', file_name)) copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) make("code-experiments/test/unit-test", "clean", verbose=_build_verbosity) make("code-experiments/test/unit-test", "all", verbose=_build_verbosity)
def build_c_integration_tests(): """ Builds integration tests in C """ copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/integration-test/coco.c') copy_file('code-experiments/src/coco.h', 'code-experiments/test/integration-test/coco.h') copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/test/integration-test/bbob2009_testcases.txt') make("code-experiments/test/integration-test", "clean") make("code-experiments/test/integration-test", "all")
def build_c_unit_tests(): """ Builds unit tests in C """ libraryPath = ''; fileName = '' if ('win32' in sys.platform): fileName = 'cmocka.dll' if '64' in platform.machine(): libraryPath = 'code-experiments/test/unit-test/lib/win64' elif ('32' in platform.machine()) or ('x86' in platform.machine()): if 'cygwin' in os.environ['PATH']: libraryPath = 'code-experiments/test/unit-test/lib/win32_cygwin' else: libraryPath = 'code-experiments/test/unit-test/lib/win32_mingw' elif ('linux' in sys.platform): fileName = 'libcmocka.so' if 'Ubuntu' in platform.linux_distribution(): libraryPath = 'code-experiments/test/unit-test/lib/linux_ubuntu' elif 'Fedora' in platform.linux_distribution(): libraryPath = 'code-experiments/test/unit-test/lib/linux_fedora' elif ('darwin' in sys.platform): # Mac libraryPath = 'code-experiments/test/unit-test/lib/macosx' fileName = 'libcmocka.dylib' if (len(libraryPath) > 0): copy_file(os.path.join(libraryPath, fileName), os.path.join('code-experiments/test/unit-test', fileName)) copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c') copy_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h') make("code-experiments/test/unit-test", "clean") make("code-experiments/test/unit-test", "all")
def test_c(): build_c() try: make("build/c", "clean") make("build/c", "all") run('build/c', ['./coco_test', 'bbob2009_testcases.txt']) except subprocess.CalledProcessError: sys.exit(-1)
def leak_check(): build_c() os.environ['CFLAGS'] = '-g -Os' make("build/c", "clean") make("build/c", "all") valgrind_cmd = ['valgrind', '--error-exitcode=1', '--track-origins=yes', '--leak-check=full', '--show-reachable=yes', './coco_test', 'bbob2009_testcases.txt'] run('build/c', valgrind_cmd)
def build_c(): global release amalgamate(core_files + ['src/coco_c_runtime.c'], 'build/c/coco.c', release) copy_file('src/coco.h', 'build/c/coco.h') copy_file('src/bbob2009_testcases.txt', 'build/c/bbob2009_testcases.txt') write_file(hg_revision(), "build/c/REVISION") write_file(hg_version(), "build/c/VERSION") make("build/c", "clean") make("build/c", "all")
def build_c(): global release amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/c/coco.c', release) copy_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h') copy_file('code-experiments/src/best_values_hyp.txt', 'code-experiments/build/c/best_values_hyp.txt') write_file(git_revision(), "code-experiments/build/c/REVISION") write_file(git_version(), "code-experiments/build/c/VERSION") make("code-experiments/build/c", "clean") make("code-experiments/build/c", "all")
def build_c_mo(): # added for the multiobjective case global release amalgamate(core_files + ['src/coco_c_runtime.c'], 'build/c/mo/coco.c', release) copy_file('src/coco.h', 'build/c/mo/coco.h') # copy_file('src/bbob2009_testcases.txt', 'build/c/bbob2009_testcases.txt') write_file(hg_revision(), "build/c/mo/REVISION") write_file(hg_version(), "build/c/mo/VERSION") make("build/c/mo", "clean") make("build/c/mo", "all")
def build_c_integration_tests(): """ Builds integration tests in C """ copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/integration-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/integration-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/test/integration-test/bbob2009_testcases.txt') copy_file('code-experiments/src/bbob2009_testcases2.txt', 'code-experiments/test/integration-test/bbob2009_testcases2.txt') make("code-experiments/test/integration-test", "clean", verbose=verbosity) make("code-experiments/test/integration-test", "all", verbose=verbosity)
def build_c_integration_tests(): """ Builds integration tests in C """ copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/integration-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/integration-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/test/integration-test/bbob2009_testcases.txt') copy_file('code-experiments/src/bbob2009_testcases2.txt', 'code-experiments/test/integration-test/bbob2009_testcases2.txt') make("code-experiments/test/integration-test", "clean", verbose=_build_verbosity) make("code-experiments/test/integration-test", "all", verbose=_build_verbosity)
def build_c(): """ Builds the C source code """ global release amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/c/coco.c', release) copy_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h') copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c') copy_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h') write_file(git_revision(), "code-experiments/build/c/REVISION") write_file(git_version(), "code-experiments/build/c/VERSION") make("code-experiments/build/c", "clean") make("code-experiments/build/c", "all")
def build_c_example_tests(): """ Builds an example experiment test in C """ if os.path.exists('code-experiments/test/example-test'): shutil.rmtree('code-experiments/test/example-test') time.sleep(1) # Needed to avoid permission errors for os.makedirs os.makedirs('code-experiments/test/example-test') copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/example-test/coco.c') copy_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h') copy_file('code-experiments/build/c/example_experiment.c', 'code-experiments/test/example-test/example_experiment.c') copy_file('code-experiments/build/c/Makefile.in', 'code-experiments/test/example-test/Makefile.in') copy_file('code-experiments/build/c/Makefile_win_gcc.in', 'code-experiments/test/example-test/Makefile_win_gcc.in') make("code-experiments/test/example-test", "clean") make("code-experiments/test/example-test", "all")
def build_c_example_tests(): if os.path.exists('code-experiments/test/example-test'): shutil.rmtree('code-experiments/test/example-test') time.sleep(1) # Needed to avoid permission errors for os.makedirs os.makedirs('code-experiments/test/example-test') copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/example-test/coco.c') copy_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h') copy_file('code-experiments/src/best_values_hyp.txt', 'code-experiments/test/example-test/best_values_hyp.txt') copy_file('code-experiments/build/c/example_bbob2009.c', 'code-experiments/test/example-test/example_bbob2009.c') copy_file('code-experiments/build/c/example_biobj.c', 'code-experiments/test/example-test/example_biobj.c') copy_file('code-experiments/build/c/example_toy.c', 'code-experiments/test/example-test/example_toy.c') copy_file('code-experiments/build/c/Makefile.in', 'code-experiments/test/example-test/Makefile.in') copy_file('code-experiments/build/c/Makefile_win_gcc.in', 'code-experiments/test/example-test/Makefile_win_gcc.in') make("code-experiments/test/example-test", "clean") make("code-experiments/test/example-test", "all")
def build_c_example_tests(): """ Builds an example experiment test in C """ if os.path.exists('code-experiments/test/example-test'): shutil.rmtree('code-experiments/test/example-test') time.sleep(1) # Needed to avoid permission errors for os.makedirs os.makedirs('code-experiments/test/example-test') copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/example-test/coco.c') expand_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h', {'COCO_VERSION': git_version(pep440=True)}) copy_file('code-experiments/build/c/example_experiment.c', 'code-experiments/test/example-test/example_experiment.c') copy_file('code-experiments/build/c/Makefile.in', 'code-experiments/test/example-test/Makefile.in') copy_file('code-experiments/build/c/Makefile_win_gcc.in', 'code-experiments/test/example-test/Makefile_win_gcc.in') make("code-experiments/test/example-test", "clean", verbose=verbosity) make("code-experiments/test/example-test", "all", verbose=verbosity)
def build_c(): """ Builds the C source code """ global RELEASE amalgamate(CORE_FILES + ['code-experiments/src/profiler/IOHprofiler_runtime_c.c'], 'code-experiments/build/c/IOHprofiler.c', RELEASE, {"IOHprofiler_VERSION": git_version(pep440=True)}) expand_file('code-experiments/src/profiler/IOHprofiler.h', 'code-experiments/build/c/profiler/IOHprofiler.h', {"IOHprofiler_VERSION": git_version(pep440=True)}) write_file(git_revision(), "code-experiments/build/c/REVISION") write_file(git_version(), "code-experiments/build/c/VERSION") if 11 < 3: python('code-experiments/build/c', ['make.py', 'clean'], verbose=_verbosity) python('code-experiments/build/c', ['make.py', 'all'], verbose=_verbosity) else: make("code-experiments/build/c", "clean", verbose=_verbosity) make("code-experiments/build/c", "all", verbose=_verbosity)
def build_c(): """ Builds the C source code """ global release amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/c/coco.c', release, {"COCO_VERSION": git_version(pep440=True)}) expand_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h', {"COCO_VERSION": git_version(pep440=True)}) copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c') expand_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h', {'COCO_VERSION': git_version(pep440=True)}) write_file(git_revision(), "code-experiments/build/c/REVISION") write_file(git_version(), "code-experiments/build/c/VERSION") if 11 < 3: python('code-experiments/build/c', ['make.py', 'clean'], verbose=verbosity) python('code-experiments/build/c', ['make.py', 'all'], verbose=verbosity) else: make("code-experiments/build/c", "clean", verbose=verbosity) make("code-experiments/build/c", "all", verbose=verbosity)