示例#1
0
  def make_makefile(directory):
    """
    Make makefile into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    make_ok = False
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)
    run_fobis(fake_args=['build', '-f', 'fobos', '-m', 'makefile_check'])
    make_ok = filecmp.cmp('makefile_check', 'makefile_ok')
    if not make_ok:
      if os.path.exists('makefile_ok2'):
        make_ok = filecmp.cmp('makefile_check', 'makefile_ok2')
      if not make_ok:
        print('makefile generated')
        with open('makefile_check', 'r') as mk_check:
          print(mk_check.read())
    run_fobis(fake_args=['clean', '-f', 'fobos'])
    os.chdir(old_pwd)
    return make_ok
示例#2
0
    def make_makefile(directory):
        """
    Make makefile into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
        print("Testing " + directory)
        make_ok = False
        old_pwd = os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)
        run_fobis(fake_args=['build', '-f', 'fobos', '-m', 'makefile_check'])
        make_ok = filecmp.cmp('makefile_check', 'makefile_ok')
        if not make_ok:
            if os.path.exists('makefile_ok2'):
                make_ok = filecmp.cmp('makefile_check', 'makefile_ok2')
            if not make_ok:
                print('makefile generated')
                with open('makefile_check', 'r') as mk_check:
                    print(mk_check.read())
        run_fobis(fake_args=['clean', '-f', 'fobos'])
        os.chdir(old_pwd)
        return make_ok
示例#3
0
  def run_install(directory):
    """
    Run the install function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    install_ok = False
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    run_fobis(fake_args=['build', '-f', 'fobos'])
    run_fobis(fake_args=['install', '-f', 'fobos', '--prefix', 'prefix'])
    files = [os.path.join(dp, f) for dp, _, filenames in os.walk('./prefix/') for f in filenames]
    install_ok = len(files) > 0

    run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    os.chdir(old_pwd)
    return install_ok
示例#4
0
  def run_install(directory):
    """
    Run the install function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    install_ok = False
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    run_fobis(fake_args=['build', '-f', 'fobos'])
    run_fobis(fake_args=['install', '-f', 'fobos', '--prefix', 'prefix'])
    files = [os.path.join(dp, f) for dp, _, filenames in os.walk('./prefix/') for f in filenames]
    install_ok = len(files) > 0

    run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    os.chdir(old_pwd)
    return install_ok
示例#5
0
  def run_build(directory):
    """
    Method for running the build function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    build_ok = False
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    try:
      run_fobis(fake_args=['build', '-f', 'fobos'])
      build_ok = os.path.exists(directory)
    except:
      if directory == 'build-test6':
        with open('building-errors.log') as logerror:
          build_ok = 'Unclassifiable statement' in list(logerror)[-1]
        os.remove('building-errors.log')

    run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    os.chdir(old_pwd)
    return build_ok
示例#6
0
    def run_build(directory):
        """
    Method for running the build function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
        print("Testing " + directory)
        build_ok = False
        old_pwd = os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

        run_fobis(fake_args=['clean', '-f', 'fobos'])

        try:
            run_fobis(fake_args=['build', '-f', 'fobos'])
            build_ok = os.path.exists(directory)
        except:
            if directory == 'build-test6':
                with open('building-errors.log') as logerror:
                    build_ok = 'Unclassifiable statement' in list(logerror)[-1]
                os.remove('building-errors.log')

        run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

        run_fobis(fake_args=['clean', '-f', 'fobos'])

        os.chdir(old_pwd)
        return build_ok
示例#7
0
  def run_rule(directory):
    """
    Run the rule function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    rule_ok = False
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['rule', '-ex', 'test'])
    rule_ok = True

    os.chdir(old_pwd)
    return rule_ok
示例#8
0
    def run_rule(directory):
        """
    Run the rule function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
        print("Testing " + directory)
        rule_ok = False
        old_pwd = os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

        run_fobis(fake_args=['rule', '-ex', 'test'])
        rule_ok = True

        os.chdir(old_pwd)
        return rule_ok
示例#9
0
  def run_clean(directory):
    """
    Method for running the clean function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['build', '-f', 'fobos'])

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    clean_ok = not os.path.exists(directory)
    os.chdir(old_pwd)
    return clean_ok
示例#10
0
    def run_clean(directory):
        """
    Method for running the clean function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
        print("Testing " + directory)
        old_pwd = os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

        run_fobis(fake_args=['build', '-f', 'fobos'])

        run_fobis(fake_args=['clean', '-f', 'fobos'])

        clean_ok = not os.path.exists(directory)
        os.chdir(old_pwd)
        return clean_ok
示例#11
0
  def run_doctest(directory):
    """
    Method for running the doctest function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
    print("Testing " + directory)
    doctest_ok = True
    old_pwd = os.getcwd()
    os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    run_fobis(fake_args=['doctests', '-f', 'fobos'])

    run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

    run_fobis(fake_args=['clean', '-f', 'fobos'])

    os.chdir(old_pwd)
    return doctest_ok
示例#12
0
    def run_doctest(directory):
        """
    Method for running the doctest function into a selected directory.

    Parameters
    ----------
    directory : str
      relative path to tested directory
    """
        print("Testing " + directory)
        doctest_ok = True
        old_pwd = os.getcwd()
        os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/' + directory)

        run_fobis(fake_args=['clean', '-f', 'fobos'])

        run_fobis(fake_args=['doctests', '-f', 'fobos'])

        run_fobis(fake_args=['rule', '-f', 'fobos', '-ex', 'finalize'])

        run_fobis(fake_args=['clean', '-f', 'fobos'])

        os.chdir(old_pwd)
        return doctest_ok