| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | |
| 21 | |
| 22 | |
| 23 |
|
| 24 | guix lint --version
|
| 25 |
|
| 26 | |
| 27 | |
| 28 | module_dir="$(mktemp -d)"
|
| 29 |
|
| 30 | mkdir -p "$module_dir"
|
| 31 | trap "rm -rf $module_dir" EXIT
|
| 32 |
|
| 33 |
|
| 34 | cat > "$module_dir/foo.scm"<<EOF
|
| 35 | (define-module (foo)
|
| 36 | #:use-module (guix packages)
|
| 37 | #:use-module (gnu packages base))
|
| 38 |
|
| 39 | ;; This definition uses (the line number of) the hello package location
|
| 40 | ;; instead of generating a new one.
|
| 41 | (define-public hi hello)
|
| 42 |
|
| 43 | (define-public dummy
|
| 44 | (package (inherit hello)
|
| 45 | (name "dummy")
|
| 46 | (version "42")
|
| 47 | (synopsis "dummy package")
|
| 48 | (description "dummy package. Only used for testing purposes.")))
|
| 49 |
|
| 50 | (define-public bar
|
| 51 | (package (inherit dummy)
|
| 52 | (name "bar")))
|
| 53 | EOF
|
| 54 |
|
| 55 | cat > "${module_dir}/foomanifest.scm"<<EOF
|
| 56 | (specifications->manifest '("dummy"))
|
| 57 | EOF
|
| 58 |
|
| 59 | GUIX_PACKAGE_PATH="$module_dir"
|
| 60 | export GUIX_PACKAGE_PATH
|
| 61 |
|
| 62 | grep_warning ()
|
| 63 | {
|
| 64 | res=`echo "$1" | grep -E -c "(synopsis|description) should"`
|
| 65 | echo $res
|
| 66 | }
|
| 67 |
|
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 |
|
| 74 | out=`guix lint -c synopsis,description dummy 2>&1`
|
| 75 | test `grep_warning "$out"` -eq 3
|
| 76 |
|
| 77 | out=`guix lint -c synopsis dummy 2>&1`
|
| 78 | test `grep_warning "$out"` -eq 2
|
| 79 |
|
| 80 | out=`guix lint -c description dummy 2>&1`
|
| 81 | test `grep_warning "$out"` -eq 1
|
| 82 |
|
| 83 | out=`guix lint -c description,synopsis dummy 2>&1`
|
| 84 | test `grep_warning "$out"` -eq 3
|
| 85 |
|
| 86 | |
| 87 | out=`guix lint -c synopsis,description -m ${module_dir}/foomanifest.scm 2>&1`
|
| 88 | test `grep_warning "$out"` -eq 3
|
| 89 |
|
| 90 | working_dir="$(pwd)"
|
| 91 | cd "$module_dir"
|
| 92 | out=`guix lint -c name -f foo.scm 2>&1`
|
| 93 | cd "$working_dir"
|
| 94 | test `echo "$out" | grep -E -c "breaks from alphabetical order"` -eq 1
|
| 95 |
|
| 96 | guix lint -c synopsis,invalid-checker dummy 2>&1 | \
|
| 97 | grep -q 'invalid-checker: invalid checker'
|
| 98 |
|
| 99 | |
| 100 | guix lint -c inputs-should-be-native dummy dummy@42 dummy
|
| 101 |
|
| 102 |
|
| 103 | |
| 104 | unset GUIX_PACKAGE_PATH
|
| 105 |
|
| 106 | out=`guix lint -L $module_dir -c synopsis,description dummy 2>&1`
|
| 107 | test `grep_warning "$out"` -eq 3
|
| 108 |
|
| 109 | |
| 110 | guix lint -L $module_dir -c inputs-should-be-native dummy dummy@42 dummy
|
| 111 |
|
| 112 | |
| 113 | |
| 114 | |
| 115 | (cd "$module_dir"/.. ; guix lint -c formatting -L "$(basename "$module_dir")" dummy@42) 2>&1 > "$module_dir/out"
|
| 116 | test -z "$(cat "$module_dir/out")"
|
| 117 |
|
| 118 | |
| 119 | |
| 120 | (cd "$module_dir"/.. ; guix lint -c synopsis -L "$(basename "$module_dir")" dummy@42) 2>&1 > "$module_dir/out"
|
| 121 | grep_warning "`cat "$module_dir/out"`"
|