src/tests/cli/t_pkg_install_basics.py
changeset 443 5ffa5b7dac9c
parent 432 578875da6e04
child 472 9cec1a1677e1
equal deleted inserted replaced
442:01fb28d438b3 443:5ffa5b7dac9c
    26 import testutils
    26 import testutils
    27 if __name__ == "__main__":
    27 if __name__ == "__main__":
    28 	testutils.setup_environment("../../../proto")
    28 	testutils.setup_environment("../../../proto")
    29 
    29 
    30 import os
    30 import os
       
    31 import time
    31 import unittest
    32 import unittest
       
    33 from stat import *
    32 
    34 
    33 class TestPkgInstallBasics(testutils.SingleDepotTestCase):
    35 class TestPkgInstallBasics(testutils.SingleDepotTestCase):
    34 
    36 
    35         foo10 = """
    37         foo10 = """
    36             open [email protected],5.11-0
    38             open [email protected],5.11-0
    37             close """
    39             close """
    38 
    40 
    39         foo11 = """
    41         foo11 = """
    40             open [email protected],5.11-0
    42             open [email protected],5.11-0
    41             add dir mode=0755 owner=root group=bin path=/lib
    43             add dir mode=0755 owner=root group=bin path=/lib
    42             add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1
    44             add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1 timestamp="20080731T024051Z"
    43             close """
    45             close """
       
    46         foo11_timestamp = 1217472051
    44 
    47 
    45         foo12 = """
    48         foo12 = """
    46             open [email protected],5.11-0
    49             open [email protected],5.11-0
    47             add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1
    50             add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1
    48             close """
    51             close """
    63 
    66 
    64         bar12 = """
    67         bar12 = """
    65             open [email protected],5.11-0
    68             open [email protected],5.11-0
    66             add depend type=require fmri=pkg:/[email protected]
    69             add depend type=require fmri=pkg:/[email protected]
    67             add dir mode=0755 owner=root group=bin path=/bin
    70             add dir mode=0755 owner=root group=bin path=/bin
    68             add file /tmp/cat mode=0555 owner=root group=bin path=/bin/cat
    71             add file /tmp/cat mode=0555 owner=root group=bin path=/bin/cat 
    69             close """
    72             close """
    70 
    73 
    71         baz10 = """
    74         baz10 = """
    72             open [email protected],5.11-0
    75             open [email protected],5.11-0
    73             add depend type=require fmri=pkg:/[email protected]
    76             add depend type=require fmri=pkg:/[email protected]
   135                 self.pkg("search /lib/libc.so.1")
   138                 self.pkg("search /lib/libc.so.1")
   136                 self.pkg("search -r /lib/libc.so.1")
   139                 self.pkg("search -r /lib/libc.so.1")
   137                 self.pkg("search blah", exit = 1)
   140                 self.pkg("search blah", exit = 1)
   138                 self.pkg("search -r blah", exit = 1)
   141                 self.pkg("search -r blah", exit = 1)
   139 
   142 
       
   143                 # check to make sure timestamp was set to correct value
       
   144 
       
   145                 libc_path = os.path.join(self.get_img_path(), "lib/libc.so.1")
       
   146                 stat = os.stat(libc_path)
       
   147 
       
   148                 assert (stat[ST_MTIME] == self.foo11_timestamp)
       
   149 
       
   150                 # check that verify finds changes
       
   151                 now = time.time()
       
   152                 os.utime(libc_path, (now, now))
       
   153                 self.pkg("verify", exit=1)
       
   154 
   140                 self.pkg("uninstall foo")
   155                 self.pkg("uninstall foo")
   141                 self.pkg("verify")
   156                 self.pkg("verify")
   142                 self.pkg("list -a")
   157                 self.pkg("list -a")
   143                 self.pkg("verify")
   158                 self.pkg("verify")
   144 
   159