def test_export(toolchain, target, expected_error=None): if toolchain is None and target is None: base_dir = join(EXPORT_TMP, "zip") else: base_dir = join(EXPORT_TMP, toolchain, target) temp_dir = join(base_dir, "temp") mkdir(temp_dir) zip_path, report = export( USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, fake_build_url_resolver ) if report["success"]: move(zip_path, join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target))) print "[OK]" else: if expected_error is None: print "[ERRROR] %s" % report["errormsg"] else: if (zip_path is None) and (expected_error in report["errormsg"]): print "[OK]" else: print "[ERROR]" print " zip:", zip_path print " msg:", report["errormsg"]
def test_export(toolchain, target, expected_error=None): if toolchain is None and target is None: base_dir = join(EXPORT_TMP, "zip") else: base_dir = join(EXPORT_TMP, toolchain, target) temp_dir = join(base_dir, "temp") mkdir(temp_dir) zip_path, report = export(USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, None, fake_build_url_resolver) if report['success']: move(zip_path, join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target))) print "[OK]" else: if expected_error is None: print '[ERRROR] %s' % report['errormsg'] else: if (zip_path is None) and (expected_error in report['errormsg']): print '[OK]' else: print '[ERROR]' print ' zip:', zip_path print ' msg:', report['errormsg']
def test_export(toolchain, target, expected_error=None): if toolchain is None and target is None: base_dir = join(TEMP, "zip") else: base_dir = join(TEMP, toolchain, target) temp_dir = join(base_dir, "temp") mkdir(temp_dir) zip_path, report = export(USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, fake_build_url_resolver) if report['success']: export_name = join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target)) cmd(["mv", zip_path, export_name]) print "[OK]" else: if expected_error is None: print '[ERRROR] %s' % report['errormsg'] else: if (zip_path is None) and (expected_error in report['errormsg']): print '[OK]' else: print '[ERROR]' print ' zip:', zip_path print ' msg:', report['errormsg']
ide = options.ide # Project if options.program is None or (options.program < 0) or (options.program > (len(TESTS) - 1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message) test = Test(options.program) if not options.build: # Substitute the library builds with the sources # TODO: Substitute also the other library build paths if MBED_LIBRARIES in test.dependencies: test.dependencies.remove(MBED_LIBRARIES) test.dependencies.append(MBED_BASE) # Build the projectwith the same directory structure of the mbed online IDE project_dir = join(EXPORT_WORKSPACE, test.id) setup_user_prj(project_dir, test.source_dir, test.dependencies) # Export to selected toolchain tmp_path, report = export(project_dir, test.id, ide, mcu, EXPORT_WORKSPACE, EXPORT_TMP) if report['success']: zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (test.id, ide, mcu)) move(tmp_path, zip_path) print "[OK]" else: print '[ERRROR] %s' % report['errormsg']
if lib_macros is not None: lib_symbols.extend(lib_macros) if not options.build: # Substitute the library builds with the sources # TODO: Substitute also the other library build paths if MBED_LIBRARIES in test.dependencies: test.dependencies.remove(MBED_LIBRARIES) test.dependencies.append(MBED_BASE) # Build the project with the same directory structure of the mbed online IDE project_dir = join(EXPORT_WORKSPACE, test.id) setup_user_prj(project_dir, test.source_dir, test.dependencies) # Export to selected toolchain tmp_path, report = export(project_dir, test.id, ide, mcu, EXPORT_WORKSPACE, EXPORT_TMP, extra_symbols=lib_symbols) if report['success']: zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (test.id, ide, mcu)) move(tmp_path, zip_path) successes.append("%s::%s\t%s"% (mcu, ide, zip_path)) else: failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg'])) # Prints export results print if len(successes) > 0: print "Successful exports:" for success in successes: print " * %s"% success if len(failures) > 0: print "Failed exports:"
message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message) # Project if p is None or (p < 0) or (p > (len(TESTS)-1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message) test = Test(p) if not options.build: # Substitute the library builds with the sources # TODO: Substitute also the other library build paths if MBED_LIBRARIES in test.dependencies: test.dependencies.remove(MBED_LIBRARIES) test.dependencies.append(MBED_BASE) # Build the project with the same directory structure of the mbed online IDE project_dir = join(EXPORT_WORKSPACE, test.id) setup_user_prj(project_dir, test.source_dir, test.dependencies) # Export to selected toolchain tmp_path, report = export(project_dir, test.id, ide, mcu, EXPORT_WORKSPACE, EXPORT_TMP) if report['success']: zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (test.id, ide, mcu)) move(tmp_path, zip_path) print "[OK]" else: print '[ERRROR] %s' % report['errormsg']