CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/PKGTOOLS/tests/test_CompilerDectection.py

Go to the documentation of this file.
00001 import sys, re
00002 from os import getenv
00003 sys.path.append (getenv ("PWD"))
00004 from cmsBuild import detectCompilerVersion
00005 from cmsBuild import parseRPMLine
00006 
00007 fakespec = ["### RPM external gcc 3.4.5-CMS"]
00008 class OptionsA (object):
00009     compilerName = "gcc"
00010     compilerVersion = ""
00011 
00012 class OptionsB (object):
00013     compilerName = "gcc"
00014     compilerVersion = "4.0.1"
00015 
00016 class OptionsC (object):
00017     compilerName = "icc"
00018     compilerVersion = "4.0.1"
00019     
00020 group, name, version = parseRPMLine (fakespec, OptionsA ())
00021 assert (version == "3.4.5")
00022 group, name, version = parseRPMLine (fakespec, OptionsB ())
00023 assert (version == "4.0.1")
00024 group, name, version = parseRPMLine (fakespec, OptionsC ())
00025 assert (version == "3.4.5")
00026 assert (re.match ("[0-9][0-9][0-9]", detectCompilerVersion ("gcc")))