Exemplo n.º 1
0
if len(shared_tests):
    handle.write('if(NOT ${BUILD_SHARED_LIBS})\n')
    handle.write(
        '    message( INFO "' + str(len(shared_tests)) +
        ' shared lib unit-tests will be skipped. Check BUILD_SHARED_LIBS to run them..." )\n'
    )
    handle.write('else()\n')
    for test in shared_tests:
        handle.write('    add_subdirectory( ' + test + ' )\n')
        log.d('... including:', sdir)
        n_tests += 1
    handle.write('endif()\n')
if len(static_tests):
    handle.write('if(${BUILD_SHARED_LIBS})\n')
    handle.write(
        '    message( INFO "' + str(len(static_tests)) +
        ' static lib unit-tests will be skipped. Uncheck BUILD_SHARED_LIBS to run them..." )\n'
    )
    handle.write('else()\n')
    for test in static_tests:
        handle.write('    add_subdirectory( ' + test + ' )\n')
        log.d('... including:', sdir)
        n_tests += 1
    handle.write('endif()\n')
handle.close()

print('Generated ' + str(n_tests) + ' unit-tests')
if log.n_errors():
    sys.exit(1)
sys.exit(0)
Exemplo n.º 2
0
        #
        for configuration, serial_numbers in devices_by_test_config( test ):
            try:
                log.d( 'configuration:', configuration )
                log.debug_indent()
                devices.enable_only( serial_numbers, recycle = True )
            except RuntimeError as e:
                log.w( log.red + test.name + log.reset + ': ' + str(e) )
            else:
                test_wrapper( test, configuration )
            finally:
                log.debug_unindent()
        #
    finally:
        log.debug_unindent()

log.progress()
#
if not n_tests:
    log.e( 'No unit-tests found!' )
    sys.exit(1)
#
n_errors = log.n_errors()
if n_errors:
    log.out( log.red + str(n_errors) + log.reset, 'of', n_tests, 'test(s)', log.red + 'failed!' + log.reset + log.clear_eos )
    sys.exit(1)
#
log.out( str(n_tests) + ' unit-test(s) completed successfully' + log.clear_eos )
#
sys.exit(0)