Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.216.11.230
#!/bin/sh
# Copyright (C) 2012-2014, 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="ubuntu-distro-info"
. "${0%/*}/shunit2-helper-functions.sh"
testAll() {
local result="warty
hoary
breezy
dapper
edgy
feisty
gutsy
hardy
intrepid
jaunty
karmic
lucid
maverick
natty"
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" "natty"
success "--date 2010-05-10 -d --codename" "maverick"
}
testLatest() {
success "--date 2011-01-10 --latest" "natty"
success "--date 2010-05-10 -l --codename" "maverick"
}
testLTS() {
success "--lts --date=2011-01-10" "lucid"
}
testStable() {
success "--date=2011-01-10 -c --stable" "maverick"
success "--date=2009-01-10 -s" "intrepid"
}
testSupported() {
local result="dapper
hardy
karmic
lucid
maverick
natty"
success "--date=2011-01-10 --supported" "$result"
}
testUnsupported() {
local result="warty
hoary
breezy
edgy
feisty
gutsy
intrepid
jaunty"
success "--date=2011-01-10 --unsupported" "$result"
}
testFullname() {
success "--date=2011-01-10 --stable -f" 'Ubuntu 10.10 "Maverick Meerkat"'
success "--date=2011-01-10 --stable -f -ycreated" \
'Ubuntu 10.10 "Maverick Meerkat" -256'
success "--date=2011-01-10 --stable -f --days=created" \
'Ubuntu 10.10 "Maverick Meerkat" -256'
success "--date=2011-01-10 --stable -f -y" \
'Ubuntu 10.10 "Maverick Meerkat" -92'
success "--date=2011-01-10 --stable -f --days" \
'Ubuntu 10.10 "Maverick Meerkat" -92'
success "--date=2011-01-10 --stable -f -yrelease" \
'Ubuntu 10.10 "Maverick Meerkat" -92'
success "--date=2011-01-10 --stable -f --days=release" \
'Ubuntu 10.10 "Maverick Meerkat" -92'
success "--date=2011-01-10 --stable -f -yeol" \
'Ubuntu 10.10 "Maverick Meerkat" 456'
success "--date=2011-01-10 --stable -f --days=eol" \
'Ubuntu 10.10 "Maverick Meerkat" 456'
success "--date=2011-01-10 --fullname --lts" \
'Ubuntu 10.04 LTS "Lucid Lynx"'
success "--date=2011-01-10 --fullname --lts -y" \
'Ubuntu 10.04 LTS "Lucid Lynx" -256'
success "--date=2011-01-10 --fullname --lts --days" \
'Ubuntu 10.04 LTS "Lucid Lynx" -256'
success "--date=2011-01-10 --fullname --lts -ycreated" \
'Ubuntu 10.04 LTS "Lucid Lynx" -438'
success "--date=2011-01-10 --fullname --lts --days=created" \
'Ubuntu 10.04 LTS "Lucid Lynx" -438'
success "--date=2011-01-10 --fullname --lts -yrelease" \
'Ubuntu 10.04 LTS "Lucid Lynx" -256'
success "--date=2011-01-10 --fullname --lts --days=release" \
'Ubuntu 10.04 LTS "Lucid Lynx" -256'
success "--date=2011-01-10 --fullname --lts -yeol" \
'Ubuntu 10.04 LTS "Lucid Lynx" 850'
success "--date=2011-01-10 --fullname --lts --days=eol" \
'Ubuntu 10.04 LTS "Lucid Lynx" 850'
success "--date=2011-01-10 --fullname --lts -yeol-server" \
'Ubuntu 10.04 LTS "Lucid Lynx" 1570'
success "--date=2011-01-10 --fullname --lts --days=eol-server" \
'Ubuntu 10.04 LTS "Lucid Lynx" 1570'
}
testRelease() {
success "--date=2011-01-10 --lts --release" "10.04 LTS"
success "--date=2011-01-10 --lts --release -ycreated" \
"10.04 LTS -438"
success "--date=2011-01-10 --lts --release --days=created" \
"10.04 LTS -438"
success "--date=2011-01-10 --lts --release --days" \
"10.04 LTS -256"
success "--date=2011-01-10 --lts --release -y" \
"10.04 LTS -256"
success "--date=2011-01-10 --lts --release --days=release" \
"10.04 LTS -256"
success "--date=2011-01-10 --lts --release -yrelease" \
"10.04 LTS -256"
success "--date=2011-01-10 --lts --release --days=eol" \
"10.04 LTS 850"
success "--date=2011-01-10 --lts --release -yeol" \
"10.04 LTS 850"
success "--date=2011-01-10 --lts --release --days=eol-server" \
"10.04 LTS 1570"
success "--date=2011-01-10 --lts --release -yeol-server" \
"10.04 LTS 1570"
success "--date=2011-01-10 -r --stable" "10.10"
}
testSeries() {
success "-r --series warty" "4.10"
}
testCombinedShortform() {
success "-fs --date=2011-01-10" 'Ubuntu 10.10 "Maverick Meerkat"'
}
testReleaseDate() {
success "--date 2010-04-28 -s" "karmic"
success "--date 2010-04-28 -d" "lucid"
success "--date 2010-04-29 -s" "lucid"
success "--date 2010-04-29 -d" "maverick"
}
testHelp() {
local help='Usage: ubuntu-distro-info [options]
Options:
-h --help show this help message and exit
--date=DATE date for calculating the version (default: today)
--series=SERIES series to calculate the version for
-y[MILESTONE] additionally, display days until milestone
--days=[MILESTONE] (created, release, eol, eol-server, eol-esm)
-a --all list all known versions
-d --devel latest development version
--lts latest long term support (LTS) version
-s --stable latest stable version
--supported list of all supported stable versions
--supported-esm list of all Ubuntu Advantage supported stable versions
--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 ubuntu-distro-info(1) for more info.'
success "--help" "$help"
success "-h" "$help"
}
testExactlyOne() {
local result='ubuntu-distro-info: You have to select exactly one of --all, --devel, --latest, --lts, --stable, --supported, --supported-esm, --series, --unsupported.'
failure "" "$result"
failure "--date=2009-01-10 -sad" "$result"
}
testUnrecognizedOption() {
failure "--bar" "ubuntu-distro-info: unrecognized option \`--bar'"
failure "-z" "ubuntu-distro-info: unrecognized option \`-z'"
failure "--testing" "ubuntu-distro-info: unrecognized option \`--testing'"
failure "--oldstable" "ubuntu-distro-info: unrecognized option \`--oldstable'"
}
testUnrecognizedArguments() {
failure "foo" "ubuntu-distro-info: unrecognized arguments: foo"
failure "foo --all bar" "ubuntu-distro-info: unrecognized arguments: foo bar"
}
testMissingArgumentDate() {
failure "--date" "ubuntu-distro-info: option \`--date' requires an argument DATE"
}
testMissingArgumentSeries() {
failure "--series" "ubuntu-distro-info: option \`--series' requires an argument SERIES"
}
testDistributionDataOutdated() {
local future_year=$(expr $(date +"%Y" --date=now) + 7)
local outdated_e="Distribution data outdated.
Please check for an update for distro-info-data. See /usr/share/doc/distro-info-data/README.Debian for details."
failure "--date 1970-10-03 --lts" "ubuntu-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -s" "ubuntu-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -d" "ubuntu-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -l" "ubuntu-distro-info: $outdated_e"
}
testInvalidDate() {
failure "--date fail -s" "ubuntu-distro-info: invalid date \`fail'"
failure "--date=2010-02-30 -d" "ubuntu-distro-info: invalid date \`2010-02-30'"
}
testInvalidSeries() {
failure "--series wr0ng" "ubuntu-distro-info: invalid distribution series \`wr0ng'"
}
testMultipleDates() {
failure "--date 2007-06-05 -s --date 2004-03-02" "ubuntu-distro-info: Date specified multiple times."
}
testMultipleSeries() {
failure "--series trusty --series utopic" "ubuntu-distro-info: series requested multiple times."
}
testUnknownSeries() {
failure "--series foobar" "ubuntu-distro-info: unknown distribution series \`foobar'"
}
testDays() {
# day after lucid released
date=2010-04-30
success "--date=$date --lts" "lucid"
success "--date=$date --lts --days=created" "-183"
success "--date=$date --lts --days=created -c" "lucid -183"
success "--date=$date --lts --days=created -f" "Ubuntu 10.04 LTS \"Lucid Lynx\" -183"
success "--date=$date --lts --days=created -r" "10.04 LTS -183"
success "--date=$date --lts --days=release" "-1"
success "--date=$date --lts --days=release -c" "lucid -1"
success "--date=$date --lts --days=release -f" "Ubuntu 10.04 LTS \"Lucid Lynx\" -1"
success "--date=$date --lts --days=release -r" "10.04 LTS -1"
success "--date=$date --lts --days" "-1"
success "--date=$date --lts --days -c" "lucid -1"
success "--date=$date --lts --days -f" "Ubuntu 10.04 LTS \"Lucid Lynx\" -1"
success "--date=$date --lts --days -r" "10.04 LTS -1"
success "--date=$date --lts --days=eol" "1105"
success "--date=$date --lts --days=eol -c" "lucid 1105"
success "--date=$date --lts --days=eol -f" "Ubuntu 10.04 LTS \"Lucid Lynx\" 1105"
success "--date=$date --lts --days=eol -r" "10.04 LTS 1105"
success "--date=$date --lts --days=eol-server" "1825"
success "--date=$date --lts --days=eol-server -c" "lucid 1825"
success "--date=$date --lts --days=eol-server -f" "Ubuntu 10.04 LTS \"Lucid Lynx\" 1825"
success "--date=$date --lts --days=eol-server -r" "10.04 LTS 1825"
# date precise released
date=2012-04-26
success "--date=$date --lts" "precise"
success "--date=$date --lts --days=created" "-196"
success "--date=$date --lts --days=created -c" "precise -196"
success "--date=$date --lts --days=created -f" "Ubuntu 12.04 LTS \"Precise Pangolin\" -196"
success "--date=$date --lts --days=created -r" "12.04 LTS -196"
success "--date=$date --lts --days=release" "0"
success "--date=$date --lts --days=release -c" "precise 0"
success "--date=$date --lts --days=release -f" "Ubuntu 12.04 LTS \"Precise Pangolin\" 0"
success "--date=$date --lts --days=release -r" "12.04 LTS 0"
success "--date=$date --lts --days" "0"
success "--date=$date --lts --days -c" "precise 0"
success "--date=$date --lts --days -f" "Ubuntu 12.04 LTS \"Precise Pangolin\" 0"
success "--date=$date --lts --days -r" "12.04 LTS 0"
success "--date=$date --lts --days=eol" "1826"
success "--date=$date --lts --days=eol -c" "precise 1826"
success "--date=$date --lts --days=eol -f" "Ubuntu 12.04 LTS \"Precise Pangolin\" 1826"
success "--date=$date --lts --days=eol -r" "12.04 LTS 1826"
success "--date=$date --lts --days=eol-server" "1826"
success "--date=$date --lts --days=eol-server -c" "precise 1826"
success "--date=$date --lts --days=eol-server -f" "Ubuntu 12.04 LTS \"Precise Pangolin\" 1826"
success "--date=$date --lts --days=eol-server -r" "12.04 LTS 1826"
# day before raring was released
date=2013-04-24
success "--devel --date=$date" "raring"
success "--devel --date=$date --days=created" "-188"
success "--devel --date=$date --days=created -c" "raring -188"
success "--devel --date=$date --days=created -r" "13.04 -188"
success "--devel --date=$date --days=created -f" "Ubuntu 13.04 \"Raring Ringtail\" -188"
success "--devel --date=$date --days" "1"
success "--devel --date=$date --days -c" "raring 1"
success "--devel --date=$date --days -r" "13.04 1"
success "--devel --date=$date --days -f" "Ubuntu 13.04 \"Raring Ringtail\" 1"
success "--devel --date=$date --days=release" "1"
success "--devel --date=$date --days=release -c" "raring 1"
success "--devel --date=$date --days=release -r" "13.04 1"
success "--devel --date=$date --days=release -f" "Ubuntu 13.04 \"Raring Ringtail\" 1"
success "--devel --date=$date --days=eol" "278"
success "--devel --date=$date --days=eol -c" "raring 278"
success "--devel --date=$date --days=eol -r" "13.04 278"
success "--devel --date=$date --days=eol -f" "Ubuntu 13.04 \"Raring Ringtail\" 278"
}
. shunit2
|