Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev guide? #68

Closed
argriffing opened this issue Nov 29, 2015 · 2 comments
Closed

dev guide? #68

argriffing opened this issue Nov 29, 2015 · 2 comments

Comments

@argriffing
Copy link

I'm wondering how to set up an arb development environment, especially with respect to building and testing? I've made a couple of PRs already but with a pretty inefficient workflow that involves rebuilding and retesting everything all the time.

Below I'm pasting the kind of script I'm starting to write to work around this. Is there a better way? If not, that is OK.

from __future__ import print_function, division

import subprocess
import argparse
import os

def main(subdirectory):

    # Find the full path to the subdirectory.
    cwd = os.getcwd()
    p = os.path.join(cwd, 'build', subdirectory, 'test')

    # Identify files in the test directory ending with ".d".
    # These are dependency files which correspond to the executable tests.
    testfiles = []
    for filename in os.listdir(p):
        base, extension = os.path.splitext(filename)
        if extension == '.d':
            testfiles.append(base)
    if testfiles:
        print('found', len(testfiles), 'test scripts')
        # Define the environment variables for the test scripts.
        scriptenv = os.environ.copy()
        scriptenv['LD_LIBRARY_PATH'] = cwd
        for testfile in testfiles:
            name = os.path.join(p, testfile)
            proc = subprocess.Popen([name], env=scriptenv)
            proc.wait()
    else:
        print('did not find any test scripts')

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--subdirectory', '-s', required=True,
            help='a subdirectory to test (e.g. acb_mat)')
    args = parser.parse_args()
    main(args.subdirectory)
@fredrik-johansson
Copy link
Collaborator

make check runs all tests, and make check MOD=acb_mat runs tests for the acb_mat module.

Normally, if you make changes to one module, there's no need to test the whole library (unless you changed a function that is used elsewhere).

Personally, I've simply placed the Arb source directory in LD_LIBRARY_PATH in my .bashrc. After make and make check (or make check MOD=acb_mat) to build the test programs, I can execute single tests like build/acb_mat/test/t-mul directly.

@argriffing
Copy link
Author

Thanks, I see now that the MOD option is explained in the flint manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants