Exemplo n.º 1
0
    def test_msvc_invalid(self):
        detector = CompilerDetector("msvc", "cl.exe", "windows")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24213.1 for x86"
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 2
0
    def test_clang_invalid(self):
        detector = CompilerDetector("clang", "clang++", "linux")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "clang version 20170406."
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 3
0
    def test_gcc_invalid(self):
        detector = CompilerDetector("gcc", "g++", "linux")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "gcc version 20170406 (Ubuntu 6.3.0-12ubuntu2)"
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 4
0
    def test_clang_invalid(self):
        detector = CompilerDetector("clang", "clang++", "linux")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "clang version 20170406."
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 5
0
    def test_msvc_invalid(self):
        detector = CompilerDetector("msvc", "cl.exe", "windows")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24213.1 for x86"
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 6
0
    def test_gcc_invalid(self):
        detector = CompilerDetector("gcc", "g++", "linux")

        compiler_out = ""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
        compiler_out = "gcc version 20170406 (Ubuntu 6.3.0-12ubuntu2)"
        self.assertEqual(detector.version_from_compiler_output(compiler_out), None)
Exemplo n.º 7
0
    def test_clang_version_appleclang_intermediate(self):
        # fake versions in between the knwon ones
        # clang-700.0.0 is lower than all known versions
        # clang-802.1.0 is a minor update of known clang-802
        # clang-1111.9.99 is a random future value
        detector = CompilerDetector("clang", "clang++", "darwin")

        compiler_out = """Apple LLVM version 7.0.0 (clang-700.0.0)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out),
                         "3.7")

        compiler_out = """Apple LLVM version 8.1.1 (clang-802.1.0)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out),
                         "3.9")

        compiler_out = """Apple LLVM version 11.11.0 (clang-1111.9.99)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out),
                         "4.0")
Exemplo n.º 8
0
    def test_msvc_version(self):
        detector = CompilerDetector("msvc", "cl.exe", "windows")
        compiler_out = """msvc_version.c

1900
"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.0")

        compiler_out = """msvc_version.c

1910
"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.10")
Exemplo n.º 9
0
    def test_clang_version_appleclang(self):
        detector = CompilerDetector("clang", "clang++", "darwin")
        compiler_out = """Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.9")

        compiler_out = """Apple LLVM version 9.0.0 (clang-900.0.35)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "4.0")
Exemplo n.º 10
0
    def test_msvc_version(self):
        detector = CompilerDetector("msvc", "cl.exe", "windows")
        compiler_out = """msvc_version.c

1900
"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.0")

        compiler_out = """msvc_version.c

1910
"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "19.10")
Exemplo n.º 11
0
    def test_clang_version_appleclang(self):
        detector = CompilerDetector("clang", "clang++", "darwin")
        compiler_out = """Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.9")

        compiler_out = """Apple LLVM version 9.0.0 (clang-900.0.35)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "4.0")
Exemplo n.º 12
0
    def test_clang_version(self):
        detector = CompilerDetector("clang", "clang++", "linux")
        compiler_out = """clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "4.0")
Exemplo n.º 13
0
    def test_clang_version(self):
        detector = CompilerDetector("clang", "clang++", "linux")
        compiler_out = """clang version 4.0.0-1ubuntu1 (tags/RELEASE_400/rc1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out),
                         "4.0")
Exemplo n.º 14
0
    def test_gcc_version(self):
        detector = CompilerDetector("gcc", "g++", "linux")
        compiler_out = """Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.3.0-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "6.3")
Exemplo n.º 15
0
    def test_gcc_version(self):
        detector = CompilerDetector("gcc", "g++", "linux")
        compiler_out = """Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.3.0-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "6.3")
Exemplo n.º 16
0
    def test_clang_version_two_digit(self):
        # Output from Crystax NDK. Note: there is a trailing whitespace behind the version
        # number for whatever reason. But let's keep the original output unchanged.
        # pylint: disable=trailing-whitespace
        detector = CompilerDetector("clang", "clang++", "android")
        compiler_out = """clang version 3.7 
Target: i686-none-linux-android
Thread model: posix
Found candidate GCC installation: /foo/crystax-toolchains/x86/bin/../lib/gcc/i686-linux-android/4.9
Selected GCC installation: /foo/crystax-toolchains/x86/bin/../lib/gcc/i686-linux-android/4.9
Candidate multilib: .;@m32
Selected multilib: .;@m32"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.7")
Exemplo n.º 17
0
    def test_clang_version_two_digit(self):
        # Output from Crystax NDK. Note: there is a trailing whitespace behind the version
        # number for whatever reason. But let's keep the original output unchanged.
        # pylint: disable=trailing-whitespace
        detector = CompilerDetector("clang", "clang++", "android")
        compiler_out = """clang version 3.7 
Target: i686-none-linux-android
Thread model: posix
Found candidate GCC installation: /foo/crystax-toolchains/x86/bin/../lib/gcc/i686-linux-android/4.9
Selected GCC installation: /foo/crystax-toolchains/x86/bin/../lib/gcc/i686-linux-android/4.9
Candidate multilib: .;@m32
Selected multilib: .;@m32"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.7")
Exemplo n.º 18
0
    def test_clang_version_appleclang_intermediate(self):
        # fake versions in between the knwon ones
        # clang-700.0.0 is lower than all known versions
        # clang-802.1.0 is a minor update of known clang-802
        # clang-1111.9.99 is a random future value
        detector = CompilerDetector("clang", "clang++", "darwin")

        compiler_out = """Apple LLVM version 7.0.0 (clang-700.0.0)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.7")

        compiler_out = """Apple LLVM version 8.1.1 (clang-802.1.0)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "3.9")

        compiler_out = """Apple LLVM version 11.11.0 (clang-1111.9.99)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"""
        self.assertEqual(detector.version_from_compiler_output(compiler_out), "4.0")