def test_0012_find_firmware_file_bin():
    """Make sure that qmk_commands.find_firmware_file() can find a bin file.
    """
    fd, test_firmware = mkstemp(suffix='.bin', dir='.')
    firmware_file = qmk_commands.find_firmware_file()
    os.remove(test_firmware)
    assert os.path.split(test_firmware)[-1] == firmware_file
Exemple #2
0
def compile_keymap(job, result):
    logging.debug('Executing build: %s', result['command'])
    chdir('qmk_firmware/')
    try:
        hash = check_output(['git', 'rev-parse', 'HEAD'])
        open('version.txt', 'w').write(hash.decode('cp437') + '\n')
        result['output'] = check_output(result['command'],
                                        stderr=STDOUT,
                                        universal_newlines=True)
        result['returncode'] = 0
        result['firmware_filename'] = find_firmware_file()
        result['firmware'] = 'binary file'
        if result['firmware_filename'].endswith('.hex'):
            result['firmware'] = open(result['firmware_filename'],
                                      'r').read()  # FIXME: Remove this for v2

    except CalledProcessError as build_error:
        logging.error('Could not build firmware (%s): %s', build_error.cmd,
                      build_error.output)
        result['returncode'] = build_error.returncode
        result['cmd'] = build_error.cmd
        result['output'] = build_error.output

    finally:
        store_firmware_metadata(job, result)
        chdir('..')
def compile_keymap(job, result):
    logging.debug('Executing build: %s', result['command'])
    try:
        result['output'] = check_output(result['command'], stderr=STDOUT, universal_newlines=True)
        result['returncode'] = 0
        result['firmware_filename'] = find_firmware_file()

        if not result['firmware_filename']:
            # Build returned success but no firmware file on disk
            result['return_code'] = -4

    except CalledProcessError as build_error:
        print('Could not build firmware (%s): %s' % (build_error.cmd, build_error.output))
        result['returncode'] = build_error.returncode
        result['cmd'] = build_error.cmd
        result['output'] = build_error.output
Exemple #4
0
def compile_keymap(job, result):
    logging.debug('Executing build: %s', result['command'])
    chdir('qmk_firmware/')
    try:
        result['output'] = check_output(result['command'],
                                        stderr=STDOUT,
                                        universal_newlines=True)
        result['returncode'] = 0
        result['firmware_filename'] = find_firmware_file()

    except CalledProcessError as build_error:
        logging.error('Could not build firmware (%s): %s', build_error.cmd,
                      build_error.output)
        result['returncode'] = build_error.returncode
        result['cmd'] = build_error.cmd
        result['output'] = build_error.output

    finally:
        store_firmware_metadata(job, result)
        chdir('..')