# -*- coding: utf-8
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
from . import testutils
if __name__ == "__main__":
import os
import pkg5unittest
import sys
import unittest
# leverage smf test infrastructure here
smf_cmds = {
from __future__ import print_function
import os
import resource
import sys
def main():
installed_version = os.environ.get("PKG_INSTALLED_VERSION", None)
if not installed_version:
return 0
for n in range(1, len(sys.argv)):
key, value = sys.argv[n].split("=", 1)
if key == "check.include":
if installed_version > value is True:
print("{0}".format(key), file=sys.stderr)
return 1
return 0
if key == "check.exclude":
if value > installed_version is True:
print("{0}".format(key), file=sys.stderr)
return 1
return 0
if key == "dump_core":
# avoid creating a core file
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
os.abort()
print("Neither check.include nor check.exclude specified in dependency")
return 242
if __name__ == "__main__":
# Make all warnings be errors.
import warnings
warnings.simplefilter('error')
sys.exit(main())
"""}
for t in (
("1.0", "cpu", "argo"),
("1.1", "cpu", "babinda"),
("1.2", "cpu", "coolabah"),
("1.3", "cpu", "drongo"),
("2.0", "platform", "dropbear"),
("2.1", "platform", "hoopsnake"),
("2.2", "platform", "oodnadatta"),
("3.0", "iset", "absinthe"),
("3.1", "iset", "bolli"),
("3.4", "iset", "limoncello")
):
open A@{0},5.11-0
add depend type=origin root-image=true fmri=pkg:/feature/cpu check.version-type={1} check.include={2}
close
open B@{3},5.12-0
add depend type=origin root-image=true fmri=pkg:/feature/cpu check.version-type={4} check.exclude={5}
close """.format(*(t + t))]
open A@1.7,5.11-0
close """]
open A@1.8,5.12-0
close"""]
open C@1.0,5.11-0
close"""]
"""test origin cpu dependency
cpu test simulator uses alphabetic comparison"""
raise pkg5unittest.TestSkippedException(
"cpu check unsupported on this platform.")
# trim some of the versions out; note that pkgs w/ cpu
# exercise general error codes
# verify that upreving the cpu lets us install more
# this is a trick, there is no v1.6
# check that we ignore dependencies w/ missing enumerators