lundi 25 juillet 2016

Taking the tests from git/t/ and applying them to a repo

I'd like to take a subset of the tests found in git's tests and apply the git commands to an actual repo.

The format for the tests basically looks like this:

test_expect_success setup '
    echo Hello >file &&
    git add file &&
    test_tick &&
    git commit -m V1 &&
    echo Hello world >file &&
    git add file &&
    git checkout -b other
'

There are two problems with this. One, it's inside a test structure and these commits it's making aren't real commits in a git repo. Two, it references other methods defined within the same file as this was extracted from like test_tick.

My first attempt was to over-write the test_expect_success method to simply execute the the $2 param. This didn't work very well so I then attempted to only execute commands from $2 that were prepended with the word "git" which meant I missed out on lines like the first one starting with echo.

I just want to make sure that someone hasn't already tried this and I'm not duplicating their efforts, or looking for someone to guide me in the right direction.

The purpose of this is to stress test a upstream repository with all kinds of different get commit scenarios, if anyone is curious.

Thanks!

Aucun commentaire:

Enregistrer un commentaire