diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-10-12 23:42:26 +0200 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2016-10-13 09:02:25 +0000 |
commit | f2061f85bf4d3d005668c3192589f0d242a49a36 (patch) | |
tree | 7b5d71d5d7aa46f2fc22288648bccd598218519b /solenv/qa/python | |
parent | 7f77e6840d73c890e9cd0a94cab32b25d77883ae (diff) |
add initial json export for gbuild data
- also add gbuild selftest to test this (and possibly more later)
Change-Id: Ia4ef41095613e596f39d107df700e929579ba45f
Reviewed-on: https://gerrit.libreoffice.org/29744
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'solenv/qa/python')
-rw-r--r-- | solenv/qa/python/gbuildtoide.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/solenv/qa/python/gbuildtoide.py b/solenv/qa/python/gbuildtoide.py new file mode 100644 index 000000000000..6184f9170115 --- /dev/null +++ b/solenv/qa/python/gbuildtoide.py @@ -0,0 +1,56 @@ +''' + This is file is part of the LibreOffice project. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + This file incorporates work covered by the following license notice: + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright + ownership. The ASF licenses this file to you under the Apache + License, Version 2.0 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 . +''' + +import subprocess +import unittest +import json +import os +import os.path + + +class CheckGbuildToIde(unittest.TestCase): + + def test_gbuildtoide(self): + os.chdir(os.path.join(os.environ['SRCDIR'], 'solenv', 'qa', 'python', 'selftest')) + subprocess.check_call(['make', 'gbuildtoide']) + jsonfiles = os.listdir(os.path.join(os.environ['WORKDIR'], 'GbuildToIde', 'Library')) + gbuildlibs = [] + for jsonfilename in jsonfiles: + with open(os.path.join(os.environ['WORKDIR'], 'GbuildToIde', 'Library', jsonfilename), 'r') as f: + print('loading %s' % jsonfilename) + gbuildlibs.append(json.load(f)) + foundlibs = set() + for lib in gbuildlibs: + self.assertEqual(set(lib.keys()), set(['ASMOBJECTS', 'CFLAGS', 'COBJECTS', 'CXXFLAGS', 'CXXOBJECTS', 'DEFS', 'GENCOBJECTS', 'GENCXXOBJECTS', 'ILIBTARGET', 'INCLUDE', 'LINKED_LIBS', 'LINKED_STATIC_LIBS', 'LINKTARGET', 'OBJCFLAGS', 'OBJCOBJECTS', 'OBJCXXFLAGS', 'OBJCXXOBJECTS', 'YACCOBJECTS'])) + if lib['LINKTARGET'].find('gbuildselftestdep') != -1: + foundlibs.add('gbuildselftestdep') + elif lib['LINKTARGET'].find('gbuildselftest') != -1: + foundlibs.add('gbuildselftest') + self.assertIn('-Igbuildtoidetestinclude', lib['INCLUDE'].split()) + self.assertIn('gbuildselftestdep', lib['LINKED_LIBS'].split()) + self.assertIn('solenv/qa/python/selftest/selftestobject', lib['CXXOBJECTS'].split()) + self.assertIn('-DGBUILDSELFTESTDEF', lib['DEFS'].split()) + self.assertIn('-DGBUILDSELFTESTCXXFLAG', lib['CXXFLAGS'].split()) + self.assertIn('-DGBUILDSELFTESTCFLAG', lib['CFLAGS'].split()) + else: + self.assertTrue(False) + self.assertEqual(foundlibs, set(['gbuildselftest', 'gbuildselftestdep'])) + self.assertEqual(len(foundlibs), 2) + +if __name__ == "__main__": + unittest.main() |