diff --git a/testing/external/Makefile b/testing/external/Makefile index cb215246c6..994d8962c0 100644 --- a/testing/external/Makefile +++ b/testing/external/Makefile @@ -1,18 +1,26 @@ PUBLIC_REPO=git://git.bro-ids.org/bro-testing +REPOS=`./scripts/find-git-repos ` DIAG=diag.log all: @rm -f $(DIAG) - @for repo in *.git; do (cd $$repo && make ); done + @for repo in $(REPOS); do (cd $$repo && make ); done brief: @rm -f $(DIAG) - @for repo in *.git; do (cd $$repo && make brief ); done + @for repo in $(REPOS); do (cd $$repo && make brief ); done init: - git clone $(PUBLIC_REPO) bro-testing.git + git clone $(PUBLIC_REPO) pull: - @for repo in *.git; do ( cd $$repo && git pull ); done + @for repo in $(REPOS); do ( cd $$repo && git pull ); done + +push: + @for repo in $(REPOS); do ( cd $$repo && git push origin HEAD ); done + +status: + @for repo in $(REPOS); do ( cd $$repo && echo '>>' $$repo && git status -bs && echo ); done + diff --git a/testing/external/README b/testing/external/README index 51a3177407..b277fc81c9 100644 --- a/testing/external/README +++ b/testing/external/README @@ -30,15 +30,15 @@ Running Tests ------------- The easiest way to run all tests is simply typing ``make``. Doing so -will iterate through all ``*.git`` repositories and run ``btest`` in -each of them. +will iterate through all git repositories found in the current +directory and run ``btest`` in each of them. Alternatively, one can also manually run all tests inside a single test repository: .. console: - > cd bro-testing.git + > cd bro-testing > btest All the standard ``btest`` options can be used to run individual @@ -51,7 +51,7 @@ To update a test's baseline, first run ``btest`` in update mode: .. console: - > cd bro-testing.git + > cd bro-testing > btest -U tests/test-you-want-to-update Then use ``git`` to commit the changes and push the changes upstream @@ -69,13 +69,13 @@ public one. A helper script is provided to set up such a repository: > ./scripts/create-new-repo The first argument is the local name of the repository (it will be -cloned into ``.git``); and then second is the path to the -git repository. The repository will be initialized with a few standard -directories as well as a skeleton test in ``.git/tests``. You +cloned into ````); and then second is the path to the git +repository. The repository will be initialized with a few standard +directories as well as a skeleton test in ``/tests``. You can then edit files as needed (and in particular add traces to -``.git/traces``). +``/traces``). If you already have such a private test repository that you want to include into the test suite, clone it directly into -``.git``. +````. diff --git a/testing/external/scripts/create-new-repo b/testing/external/scripts/create-new-repo index c1256d3e5d..eedcf3f4d5 100755 --- a/testing/external/scripts/create-new-repo +++ b/testing/external/scripts/create-new-repo @@ -7,7 +7,7 @@ if [ $# != 2 ]; then exit 1 fi -name=`pwd`/$1.git +name=`pwd`/$1 repo=$2 if [ -e $repo ]; then diff --git a/testing/external/scripts/find-git-repos b/testing/external/scripts/find-git-repos new file mode 100755 index 0000000000..5efd3346d6 --- /dev/null +++ b/testing/external/scripts/find-git-repos @@ -0,0 +1,8 @@ +#! /usr/bin/env bash +# +# Returns a list of git repositories found in subdirs of the +# current directory. + +for i in `find . -type d`; do + test -e $i/.git && echo $i +done