Ondřej Surý | 748c8e5 | 2021-05-07 18:56:31 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
Ondřej Surý | a531aef | 2021-12-12 21:42:05 +0100 | [diff] [blame^] | 4 | |
| 5 | # Setup the test file |
| 6 | trap 'rm -f "${TESTFILE}"; rmdir "${TESTDIR}"' EXIT |
| 7 | TESTDIR=$(mktemp -d /tmp/yanglint.XXXXXX) |
| 8 | TESTFILE="${TESTDIR}/ietf-interfaces.yang" |
| 9 | |
| 10 | # Unpack or copy the test file |
| 11 | if test -f /usr/share/doc/libyang2-tools/examples/ietf-interfaces.yang.gz; then |
| 12 | gunzip -c < /usr/share/doc/libyang2-tools/examples/ietf-interfaces.yang.gz > "${TESTFILE}" |
Ondřej Surý | 748c8e5 | 2021-05-07 18:56:31 +0200 | [diff] [blame] | 13 | else |
Ondřej Surý | a531aef | 2021-12-12 21:42:05 +0100 | [diff] [blame^] | 14 | cp /usr/share/doc/libyang2-tools/examples/ietf-interfaces.yang "${TESTFILE}" |
Ondřej Surý | 748c8e5 | 2021-05-07 18:56:31 +0200 | [diff] [blame] | 15 | fi |
Ondřej Surý | a531aef | 2021-12-12 21:42:05 +0100 | [diff] [blame^] | 16 | |
| 17 | # Lint the test file |
| 18 | yanglint "${TESTFILE}" |