/usr/share/distro-info/test-debian-distro-info is in distro-info 0.12.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | #!/bin/sh
# Copyright (C) 2012-2013, Benjamin Drung <bdrung@debian.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
COMMAND="debian-distro-info"
. "${0%/*}/shunit2-helper-functions.sh"
testAlias() {
success "--alias sid" "unstable"
success "--date 2010-10-20 --alias squeeze" "testing"
success "--date 2011-11-20 --alias squeeze" "stable"
success "--alias whatever" "whatever"
}
testAll() {
local result="buzz
rex
bo
hamm
slink
potato
woody
sarge
etch
lenny
squeeze
sid
experimental"
local pattern=$(echo $result | sed "s/ /\\\\|/g")
success "--date 2007-07-07 --all | grep -w \"$pattern\"" "$result"
success "-a | grep -w \"$pattern\"" "$result"
}
testDevel() {
success "--date 2011-01-10 --devel" "sid"
success "-d --date=2002-01-10 --codename" "sid"
}
testOldstable() {
success "--oldstable --date=2011-01-10" "etch"
success "-c --date=2008-07-06 -o" "sarge"
# Compatibility with 0.2.2
success "--old --date=2011-01-10" "etch"
}
testStable() {
success "--date=2011-01-10 --stable" "lenny"
success "--date=2001-02-10 -s" "potato"
}
testSupported() {
local result="lenny
squeeze
sid
experimental"
success "--date=2011-01-10 --supported" "$result"
}
testUnsupported() {
local result="buzz
rex
bo
hamm
slink
potato
woody
sarge
etch"
success "--date=2011-01-10 --unsupported" "$result"
}
testTesting() {
success "--date=2011-01-10 --testing" "squeeze"
success "-t --date=2010-01-10" "squeeze"
}
testFullname() {
success "--date=2011-01-10 --stable --fullname" 'Debian 5.0 "Lenny"'
success "--date=2011-01-10 --stable --fullname -ycreated" \
'Debian 5.0 "Lenny" -1373'
success "--date=2011-01-10 --stable --fullname --days=created" \
'Debian 5.0 "Lenny" -1373'
success "--date=2011-01-10 --stable --fullname -y" \
'Debian 5.0 "Lenny" -695'
success "--date=2011-01-10 --stable --fullname --days" \
'Debian 5.0 "Lenny" -695'
success "--date=2011-01-10 --stable --fullname -yrelease" \
'Debian 5.0 "Lenny" -695'
success "--date=2011-01-10 --stable --fullname --days=release" \
'Debian 5.0 "Lenny" -695'
success "--date=2011-01-10 --stable --fullname -yeol" \
'Debian 5.0 "Lenny" 392'
success "--date=2011-01-10 --stable --fullname --days=eol" \
'Debian 5.0 "Lenny" 392'
success "--date=2011-01-10 -f --testing" 'Debian 6.0 "Squeeze"'
success "--date=2011-01-10 -f --testing -ycreated" \
'Debian 6.0 "Squeeze" -695'
success "--date=2011-01-10 -f --testing --days=created" \
'Debian 6.0 "Squeeze" -695'
success "--date=2011-01-10 -f --testing -y" \
'Debian 6.0 "Squeeze" 27'
success "--date=2011-01-10 -f --testing --days" \
'Debian 6.0 "Squeeze" 27'
success "--date=2011-01-10 -f --testing -yrelease" \
'Debian 6.0 "Squeeze" 27'
success "--date=2011-01-10 -f --testing --days=release" \
'Debian 6.0 "Squeeze" 27'
# sid is never released so can never go eol
success "--date=2011-01-10 -f --devel -yeol" \
'Debian "Sid" (unknown)'
success "--date=2011-01-10 -f --devel --days=eol" \
'Debian "Sid" (unknown)'
}
testRelease() {
success "--date=2011-01-10 -r --devel" "sid"
success "--date=2011-01-10 --testing --release" "6.0"
success "--date=2011-01-10 --release --stable" "5.0"
}
testCombinedShortform() {
success "-rd" "sid"
}
testReleaseDate() {
success "--date 2009-02-13 -o" "sarge"
success "--date 2009-02-13 -s" "etch"
success "--date 2009-02-13 -t" "lenny"
success "--date 2009-02-13 -d" "sid"
success "--date 2009-02-14 -o" "etch"
success "--date 2009-02-14 -s" "lenny"
success "--date 2009-02-14 -t" "squeeze"
success "--date 2009-02-14 -d" "sid"
}
testHelp() {
local help='Usage: debian-distro-info [options]
Options:
-h --help show this help message and exit
--date=DATE date for calculating the version (default: today)
-y[MILESTONE] additionally, display days until milestone
--days=[MILESTONE] (created, release, eol)
--alias=DIST print the alias (stable, testing, unstable) relative to
the distribution codename passed as an argument
-a --all list all known versions
-d --devel latest development version
-o --oldstable latest oldstable version
-s --stable latest stable version
--supported list of all supported stable versions
-t --testing current testing version
--unsupported list of all unsupported stable versions
-c --codename print the codename (default)
-f --fullname print the full name
-r --release print the release version
See debian-distro-info(1) for more info.'
success "--help" "$help"
success "-h" "$help"
}
testExactlyOne() {
local result='debian-distro-info: You have to select exactly one of --alias, --all, --devel, --oldstable, --stable, --supported, --testing, --unsupported.'
failure "" "$result"
failure "-ad" "$result"
failure "--alias foo -a" "$result"
}
testUnrecognizedOption() {
failure "--foo" "debian-distro-info: unrecognized option \`--foo'"
failure "-x" "debian-distro-info: unrecognized option \`-x'"
failure "--lts" "debian-distro-info: unrecognized option \`--lts'"
}
testUnrecognizedArguments() {
failure "bar" "debian-distro-info: unrecognized arguments: bar"
failure "baz -s foo" "debian-distro-info: unrecognized arguments: baz foo"
}
testMissingArgumentAlias() {
failure "--alias" "debian-distro-info: option \`--alias' requires an argument DIST"
}
testMissingArgumentDate() {
failure "--date" "debian-distro-info: option \`--date' requires an argument DATE"
}
testInvalidAlias() {
failure "--alias Sid" "debian-distro-info: invalid distribution codename \`Sid'"
failure "--alias wr0ng" "debian-distro-info: invalid distribution codename \`wr0ng'"
}
testInvalidDate() {
failure "--date fail -s" "debian-distro-info: invalid date \`fail'"
failure "--date=2010-02-30 -d" "debian-distro-info: invalid date \`2010-02-30'"
}
testMultipleAlias() {
failure "--alias a --alias b" "debian-distro-info: --alias requested multiple times."
}
testMultipleDates() {
failure "--date 2007-06-05 -s --date 2004-03-02" "debian-distro-info: Date specified multiple times."
}
testDays() {
# day after lenny released
date=2009-02-15
success "--date=$date --stable " "lenny"
success "--date=$date --stable --days=created" "-679"
success "--date=$date --stable --days=created -c" "lenny -679"
success "--date=$date --stable --days=created -f" "Debian 5.0 \"Lenny\" -679"
success "--date=$date --stable --days=created -r" "5.0 -679"
success "--date=$date --stable --days=release" "-1"
success "--date=$date --stable --days=release -c" "lenny -1"
success "--date=$date --stable --days=release -f" "Debian 5.0 \"Lenny\" -1"
success "--date=$date --stable --days=release -r" "5.0 -1"
success "--date=$date --stable --days" "-1"
success "--date=$date --stable --days -c" "lenny -1"
success "--date=$date --stable --days -f" "Debian 5.0 \"Lenny\" -1"
success "--date=$date --stable --days -r" "5.0 -1"
success "--date=$date --stable --days=eol" "1086"
success "--date=$date --stable --days=eol -c" "lenny 1086"
success "--date=$date --stable --days=eol -f" "Debian 5.0 \"Lenny\" 1086"
success "--date=$date --stable --days=eol -r" "5.0 1086"
# date woody released
date=2002-07-19
success "--date=$date --stable" "woody"
success "--date=$date --stable --days=created" "-703"
success "--date=$date --stable --days=created -c" "woody -703"
success "--date=$date --stable --days=created -f" "Debian 3.0 \"Woody\" -703"
success "--date=$date --stable --days=created -r" "3.0 -703"
success "--date=$date --stable --days=release" "0"
success "--date=$date --stable --days=release -c" "woody 0"
success "--date=$date --stable --days=release -f" "Debian 3.0 \"Woody\" 0"
success "--date=$date --stable --days=release -r" "3.0 0"
success "--date=$date --stable --days" "0"
success "--date=$date --stable --days -c" "woody 0"
success "--date=$date --stable --days -f" "Debian 3.0 \"Woody\" 0"
success "--date=$date --stable --days -r" "3.0 0"
success "--date=$date --stable --days=eol" "1442"
success "--date=$date --stable --days=eol -c" "woody 1442"
success "--date=$date --stable --days=eol -f" "Debian 3.0 \"Woody\" 1442"
success "--date=$date --stable --days=eol -r" "3.0 1442"
# day before etch was released
date=2007-04-07
success "--testing --date=$date" "etch"
success "--testing --date=$date --days=created" "-670"
success "--testing --date=$date --days=created -c" "etch -670"
success "--testing --date=$date --days=created -f" "Debian 4.0 \"Etch\" -670"
success "--testing --date=$date --days=created -r" "4.0 -670"
success "--testing --date=$date --days" "1"
success "--testing --date=$date --days -c" "etch 1"
success "--testing --date=$date --days -f" "Debian 4.0 \"Etch\" 1"
success "--testing --date=$date --days -r" "4.0 1"
success "--testing --date=$date --days=release" "1"
success "--testing --date=$date --days=release -c" "etch 1"
success "--testing --date=$date --days=release -f" "Debian 4.0 \"Etch\" 1"
success "--testing --date=$date --days=release -r" "4.0 1"
success "--testing --date=$date --days=eol" "1045"
success "--testing --date=$date --days=eol -c" "etch 1045"
success "--testing --date=$date --days=eol -f" "Debian 4.0 \"Etch\" 1045"
success "--testing --date=$date --days=eol -r" "4.0 1045"
}
. shunit2
|