Exemple #1
0
def check_kernel_ver(ver):
    kernel_ver = os.uname()[2]
    kv_tmp = re.split(r'[-]', kernel_ver)[0:3]
    # In compare_versions, if v1 < v2, return value == -1
    if utils.compare_versions(kv_tmp[0], ver) == -1:
        raise error.TestError("Kernel too old (%s). Kernel > %s is needed." %
                              (kernel_ver, ver))
Exemple #2
0
    def test_mix_symbols(self):
        self.assertEqual(utils.compare_versions('k-320.1', 'k-320.3'), -1)
        self.assertEqual(utils.compare_versions('k-231.5', 'k-231.1'), 1)
        self.assertEqual(utils.compare_versions('k-231.1', 'k-231.1'), 0)

        self.assertEqual(utils.compare_versions('k.320-1', 'k.320-3'), -1)
        self.assertEqual(utils.compare_versions('k.231-5', 'k.231-1'), 1)
        self.assertEqual(utils.compare_versions('k.231-1', 'k.231-1'), 0)
Exemple #3
0
 def test_alphabets(self):
     self.assertEqual(utils.compare_versions('m.l.b', 'n.b.a'), -1)
     self.assertEqual(utils.compare_versions('n.b.a', 'm.l.b'), 1)
     self.assertEqual(utils.compare_versions('abc.e', 'abc.e'), 0)
Exemple #4
0
 def test_dash_delimited(self):
     self.assertEqual(utils.compare_versions('1-2-3', '1-5-1'), -1)
     self.assertEqual(utils.compare_versions('1-2-1', '1-1-1'), 1)
     self.assertEqual(utils.compare_versions('1-2-4', '1-2-4'), 0)
Exemple #5
0
 def test_unequal_len(self):
     self.assertEqual(utils.compare_versions('1.3', '1.3.4'), -1)
     self.assertEqual(utils.compare_versions('1.3.1', '1.3'), 1)
Exemple #6
0
 def test_zerofill(self):
     self.assertEqual(utils.compare_versions('1.7', '1.10'), -1)
     self.assertEqual(utils.compare_versions('1.222', '1.3'), 1)
     self.assertEqual(utils.compare_versions('1.03', '1.3'), 0)
Exemple #7
0
def check_glibc_ver(ver):
    glibc_ver = commands.getoutput("ldd --version").splitlines()[0]
    glibc_ver = re.search(r"(\d+\.\d+(\.\d+)?)", glibc_ver).group()
    if utils.compare_versions(glibc_ver, ver) == -1:
        raise error.TestError("Glibc too old (%s). Glibc >= %s is needed." % (glibc_ver, ver))
Exemple #8
0
 def test_dash_delimited(self):
     self.assertEqual(utils.compare_versions('1-2-3', '1-5-1'), -1)
     self.assertEqual(utils.compare_versions('1-2-1', '1-1-1'), 1)
     self.assertEqual(utils.compare_versions('1-2-4', '1-2-4'), 0)
Exemple #9
0
 def test_unequal_len(self):
     self.assertEqual(utils.compare_versions('1.3', '1.3.4'), -1)
     self.assertEqual(utils.compare_versions('1.3.1', '1.3'), 1)
Exemple #10
0
 def test_zerofill(self):
     self.assertEqual(utils.compare_versions('1.7', '1.10'), -1)
     self.assertEqual(utils.compare_versions('1.222', '1.3'), 1)
     self.assertEqual(utils.compare_versions('1.03', '1.3'), 0)
Exemple #11
0
def check_glibc_ver(ver):
    glibc_ver = commands.getoutput('ldd --version').splitlines()[0]
    glibc_ver = re.search(r'(\d+\.\d+(\.\d+)?)', glibc_ver).group()
    if utils.compare_versions(glibc_ver, ver) == -1:
        raise error.TestError("Glibc too old (%s). Glibc >= %s is needed." %
                              (glibc_ver, ver))
 def test_alphabets(self):
     self.assertEqual(utils.compare_versions('m.l.b', 'n.b.a'), -1)
     self.assertEqual(utils.compare_versions('n.b.a', 'm.l.b'), 1)
     self.assertEqual(utils.compare_versions('abc.e', 'abc.e'), 0)
Exemple #13
0
def check_kernel_ver(ver):
    kernel_ver = utils.system_output("uname -r")
    kv_tmp = re.split(r"[-]", kernel_ver)[0:3]
    # In compare_versions, if v1 < v2, return value == -1
    if utils.compare_versions(kv_tmp[0], ver) == -1:
        raise error.TestError("Kernel too old (%s). Kernel > %s is needed." % (kernel_ver, ver))