Skip to content

only clone a subdirectory of a git repo #3627

@jgphpc

Description

@jgphpc

Can ReFrame support sparse git clones ?

For now, I do it with a hook (I could also use a fixture but that's not the point):

import os
import reframe as rfm
import reframe.utility.sanity as sn


@rfm.simple_test
class git_clone_test(rfm.CompileOnlyRegressionTest):
    repo = variable(
        str, value='https://github.com/eth-cscs/alps-gh200-reproducers.git')
    sourcesdir = None
    build_system = 'SingleSource'
    sourcepath = 'hello.c'
    valid_systems = ['*']
    valid_prog_environs = ['*']

    @run_before('compile')
    def prepare_clone(self):
        self.prebuild_cmds = [
            f'git clone --no-checkout --depth=1 {self.repo}',
            'cd alps-gh200-reproducers',
            'git config core.sparseCheckout true',
            'echo intranode-pinned-host-comm > .git/info/sparse-checkout',
            'git checkout main',
            'cd ..'
        ]

    @sanity_function
    def validate_test(self):
        return sn.assert_not_found(r'error', self.stdout)

Ideally, I'd like to use:

    sourcesdir = 'https://github.com/eth-cscs/alps-gh200-reproducers.git:intranode-pinned-host-comm'

Metadata

Metadata

Assignees

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions