File: run_diff.sh

package info (click to toggle)
probabel 0.5.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,680 kB
  • sloc: cpp: 6,357; sh: 2,355; ansic: 1,676; makefile: 934; asm: 284; perl: 263; awk: 47
file content (23 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This file contains a function used in the various example/test
# scripts. It relies on bashisms to get the substrings when running
# the echo commands.

run_diff()
{
    # This function is run after each check. It needs three arguments:
    # $1: first file to compare
    # $2: second file to compare
    # $3: start message to print on the output line before OK or FAILED
    file1=$1
    file2=$2
    name=$3

    blanks="                                                                      "

    if diff "$file1" "$file2"; then
        echo -e "${name}${blanks:${#name}} OK"
    else
        echo -e "${name}${blanks:${#name}} FAILED"
        exit 1
    fi
}