Skip to content

Commit dd7aeb7

Browse files
authored
Merge pull request #13 from openconfig/no-test-files
Make repo compatible with test files residing in external repos
2 parents 784a1d1 + 85f4db1 commit dd7aeb7

File tree

3 files changed

+8
-171
lines changed

3 files changed

+8
-171
lines changed

.github/workflows/demo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Demo output on openconfig/public
3131
continue-on-error: true
3232
run: |
33-
OCDIR=~/tmp/public pytests/pattern_test.sh
33+
OCDIR=~/tmp/public find "$OCDIR/regexp-tests" -name "*.yang" -print0 | xargs -0 pytests/pattern_test.sh
3434
3535
posix-pattern:
3636
name: posix-pattern statement
@@ -60,4 +60,4 @@ jobs:
6060
- name: Demo output on openconfig/public
6161
continue-on-error: true
6262
run: |
63-
go run gotests/main.go -model-root ~/tmp/public testdata/regexp-test.yang
63+
find "$OCDIR/regexp-tests" -name "*.yang" -print0 | xargs -0 go run gotests/main.go -model-root ~/tmp/public

pytests/pattern_test.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ if [ -z $OCDIR ]; then
66
echo "\$OCDIR not given, using default: $OCDIR"
77
fi
88

9+
if [ $# -eq 0 ]; then
10+
echo "No regex test files supplied as an argument."
11+
exit 1
12+
fi
13+
914
TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1015
REPO_DIR="$TEST_DIR/.."
1116

1217
tmpstderr=$(mktemp)
13-
pyang -p $OCDIR -p "$REPO_DIR/testdata" --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns "$REPO_DIR/testdata/regexp-test.yang" 2> $tmpstderr
18+
pyang -p $OCDIR --msg-template="| {line} | {msg} |" --plugindir "$REPO_DIR/pytests/plugins" --check-patterns $@ 2> $tmpstderr
1419
retcode=$?
1520
if [ $retcode -ne 0 ]; then
1621
>&2 echo "| Line # | typedef | error |"

testdata/regexp-test.yang

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)