summaryrefslogtreecommitdiff
path: root/yarns/tbdiff.shell-lib
blob: 33d99545470d29e890a61499d0b90909833c1026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Shell library for tbdiff yarns.
#
# The shell functions in this library are meant to make writing IMPLEMENTS
# sections for yarn scenario tests easier.

# Currently, yarn isn't setting $SRCDIR to point at the project source
# directory.  We simulate this here.

{
    set +u
    if [ -z "$SRCDIR" ]; then
        export SRCDIR="$(pwd)"
    fi
}

# Test that the extended attributes of two files are the same by comparing the
# output of `getfattr -d` on each file, which has been piped to `tail -n +2` in
# order to skip the first line of output, being the file name.

compare_xattrs()
{
    test \
    "$(getfattr -d "$1" | tail -n +2)" = "$(getfattr -d "$2" | tail -n +2)"
}