Kaydet (Commit) dd8c8d81 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen Kaydeden (comit) Björn Michaelsen

add test for running gbuildtoide on non-build modules

- do concat for json in C++, everything else seems fragile on Windows
- have APPEND vars separately
- check that gbuildtoide work on modules without a full build (modulo
  some blacklisted "creative" ones)

Change-Id: I6fe267fee7d1b77d758072303729387dfeb8e6c8
Reviewed-on: https://gerrit.libreoffice.org/30293Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst 329ecb67
...@@ -25,6 +25,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \ ...@@ -25,6 +25,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
concat-deps \ concat-deps \
cpp \ cpp \
cppunittester \ cppunittester \
gbuildtojson \
$(if $(filter MSC,$(COM)), \ $(if $(filter MSC,$(COM)), \
gcc-wrapper \ gcc-wrapper \
g++-wrapper \ g++-wrapper \
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This 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/.
#
$(eval $(call gb_CustomTarget_CustomTarget,solenv/gbuildtesttools))
$(call gb_CustomTarget_get_target,solenv/gbuildtesttools) :
echo -n "{ \"MAKE\": \"$(if $(filter WNT,$(OS)),$(shell cygpath -u $(MAKE)),$(MAKE))\"" > $@
echo -n ", \"BASH\": \"$(if $(filter WNT,$(OS)),$(shell cygpath -m `which bash`),bash)\"" >> $@
echo -n ", \"GBUILDTOJSON\": \"$(call gb_Executable_get_target,gbuildtojson)\" }" >> $@
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This 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/.
#
$(eval $(call gb_Executable_Executable,gbuildtojson))
$(eval $(call gb_Executable_add_exception_objects,gbuildtojson,\
solenv/gbuildtojson/gbuildtojson \
))
# vim:set noet sw=4 ts=4:
...@@ -11,6 +11,7 @@ $(eval $(call gb_Module_Module,solenv)) ...@@ -11,6 +11,7 @@ $(eval $(call gb_Module_Module,solenv))
$(eval $(call gb_Module_add_targets_for_build,solenv,\ $(eval $(call gb_Module_add_targets_for_build,solenv,\
Executable_concat-deps \ Executable_concat-deps \
Executable_gbuildtojson \
)) ))
ifeq ($(COM),MSC) ifeq ($(COM),MSC)
...@@ -23,6 +24,7 @@ endif ...@@ -23,6 +24,7 @@ endif
ifneq ($(DISABLE_PYTHON),TRUE) ifneq ($(DISABLE_PYTHON),TRUE)
$(eval $(call gb_Module_add_subsequentcheck_targets,solenv,\ $(eval $(call gb_Module_add_subsequentcheck_targets,solenv,\
CustomTarget_gbuildtesttools \
PythonTest_solenv_python \ PythonTest_solenv_python \
)) ))
endif endif
......
...@@ -13,9 +13,6 @@ $(eval $(call gb_PythonTest_add_modules,solenv_python,$(SRCDIR)/solenv/qa/python ...@@ -13,9 +13,6 @@ $(eval $(call gb_PythonTest_add_modules,solenv_python,$(SRCDIR)/solenv/qa/python
gbuildtoide \ gbuildtoide \
)) ))
# force gbuildtoide.py to use the same make binary as is used here $(call gb_PythonTest_get_target,solenv_python): $(call gb_CustomTarget_get_target,solenv/gbuildtesttools)
$(eval $(call gb_PythonTest_set_defs,solenv_python,\
MAKE="$(MAKE)" \
))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -9,37 +9,43 @@ ...@@ -9,37 +9,43 @@
ifneq ($(filter gbuildtoide,$(MAKECMDGOALS)),) ifneq ($(filter gbuildtoide,$(MAKECMDGOALS)),)
# possibly recurse to ensure gbuildtojson was build before running the modded make
gb_GbuildToIde_prep := $(shell $(MAKE) -f $(SRCDIR)/solenv/Makefile Executable_gbuildtojson)
gb_FULLDEPS:= gb_FULLDEPS:=
gbuildtoide: gbuildtoide:
true @true
.PHONY : foo .PHONY : foo
foo: foo:
true @true
define gb_LinkTarget__command define gb_LinkTarget__command
mkdir -p $(WORKDIR)/GbuildToIde/$(dir $(2)) $(WORKDIR)/Headers/$(dir $(2)) mkdir -p $(WORKDIR)/GbuildToIde/$(dir $(2))
$(if $(filter WNT,$(OS)),mkdir -p $(dir $(call gb_WinResTarget_get_target,dummy))) mkdir -p $(WORKDIR)/LinkTarget/$(dir $(2))
printf '{"LINKTARGET": "%s"' '$(2)' > $(WORKDIR)/GbuildToIde/$(2) $(call gb_Executable_get_command,gbuildtojson) \
printf ', "ILIBTARGET": "%s"' '$(ILIBTARGET)' >> $(WORKDIR)/GbuildToIde/$(2) --linktarget=$(call var2file,$(shell $(gb_MKTEMP)),100,$(2)) \
printf ', "COBJECTS": "%s"' '$(COBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --ilibtarget=$(call var2file,$(shell $(gb_MKTEMP)),100,$(ILIBTARGET)) \
printf ', "CXXOBJECTS": "%s"' '$(CXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --cxxobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(CXXOBJECTS)) \
printf ', "YACCOBJECTS": "%s"' '$(YACCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --yaccobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(YACCOBJECTS)) \
printf ', "OBJCOBJECTS": "%s"' '$(OBJCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --objcobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(OBJCOBJECTS)) \
printf ', "OBJCXXOBJECTS": "%s"' '$(OBJCXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --objcxxobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(OBJCXXOBJECTS)) \
printf ', "ASMOBJECTS": "%s"' '$(ASMOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --asmobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(ASMOBJECTS)) \
printf ', "GENCOBJECTS": "%s"' '$(GENCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --gencobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(GENCOBJECTS)) \
printf ', "GENCXXOBJECTS": "%s"' '$(GENCXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$(2) --gencxxobjects=$(call var2file,$(shell $(gb_MKTEMP)),100,$(GENCXXOBJECTS)) \
printf ', "CFLAGS": "%s"' '$(T_CFLAGS) $(T_CFLAGS_APPEND)' >> $(WORKDIR)/GbuildToIde/$(2) --cflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CFLAGS)) \
printf ', "CXXFLAGS": "%s"' '$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND)' >> $(WORKDIR)/GbuildToIde/$(2) --cflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CFLAGS_APPEND)) \
printf ', "OBJCFLAGS": "%s"' '$(T_OBJCFLAGS)' >> $(WORKDIR)/GbuildToIde/$(2) --cxxflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CXXFLAGS)) \
printf ', "OBJCXXFLAGS": "%s"' '$(T_OBJCXXFLAGS)' >> $(WORKDIR)/GbuildToIde/$(2) --cxxflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_CXXFLAGS_APPEND)) \
printf ', "DEFS": "%s"' '$(DEFS)' >> $(WORKDIR)/GbuildToIde/$(2) --objcflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCFLAGS)) \
printf ', "INCLUDE": "%s"' '$(INCLUDE)' >> $(WORKDIR)/GbuildToIde/$(2) --objcflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCFLAGS_APPEND)) \
printf ', "LINKED_LIBS": "%s"' '$(LINKED_LIBS)' >> $(WORKDIR)/GbuildToIde/$(2) --objcxxflags=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCXXFLAGS)) \
printf ', "LINKED_STATIC_LIBS": "%s"' '$(LINKED_STATIC_LIBS)' >> $(WORKDIR)/GbuildToIde/$(2) --objcxxflagsappend=$(call var2file,$(shell $(gb_MKTEMP)),100,$(T_OBJCXXFLAGS_APPEND)) \
printf '}\n' >> $(WORKDIR)/GbuildToIde/$(2) --defs=$(call var2file,$(shell $(gb_MKTEMP)),100,$(DEFS)) \
--include=$(call var2file,$(shell $(gb_MKTEMP)),100,$(INCLUDE)) \
--linked_libs=$(call var2file,$(shell $(gb_MKTEMP)),100,$(LINKED_LIBS)) \
--linked_static_libs=$(call var2file,$(shell $(gb_MKTEMP)),100,$(LINKED_STATIC_LIBS)) \
> $(WORKDIR)/GbuildToIde/$(2)
endef endef
define gb_Postprocess_register_target define gb_Postprocess_register_target
...@@ -48,6 +54,46 @@ gbuildtoide : $(call gb_LinkTarget_get_target,$(call gb_$(2)_get_linktarget,$(3) ...@@ -48,6 +54,46 @@ gbuildtoide : $(call gb_LinkTarget_get_target,$(call gb_$(2)_get_linktarget,$(3)
$(call gb_LinkTarget_get_target,$(call gb_$(2)_get_linktarget,$(3))): $(gb_Helper_MISCDUMMY) foo $(call gb_LinkTarget_get_target,$(call gb_$(2)_get_linktarget,$(3))): $(gb_Helper_MISCDUMMY) foo
endef endef
gb_LinkTarget_use_static_libraries =
gb_UnoApiHeadersTarget_get_target = foo
gb_UnpackedTarball_get_final_target = foo
gb_LinkTarget__get_headers_check =
gb_LinkTarget_add_cobject = $(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
gb_LinkTarget_add_cxxobject = $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
gb_LinkTarget_use_package =
gb_LinkTarget_add_sdi_headers =
gb_LinkTarget_use_external_project =
gb_LinkTarget_add_scanners =
gb_LinkTarget_add_grammars =
gb_LinkTarget__check_srcdir_paths =
gb_LinkTarget__command_objectlist = @true
gb_WinResTarget_WinResTarget_init =
gb_WinResTarget_set_rcfile =
gb_WinResTarget_add_defs =
gb_LinkTarget_set_nativeres =
gb_LinkTarget_add_nativeres =
gb_Library_set_componentfile =
gb_LinkTarget_use_restarget =
#$(call gb_Library_get_exports_target,%):
$(WORKDIR)/LinkTarget/Library/%.exports:
@true
define gb_LinkTarget__use_custom_headers
$(call gb_LinkTarget__add_include,$(1),$(call gb_CustomTarget_get_workdir,$(2)))
endef
define gb_Module_add_target
$(if $(filter Library_% Executable_%,$(2)),$(call gb_Module__read_targetfile,$(1),$(2),target))
$(if $(filter Library_% Executable_%,$(2)),$(call gb_Module_get_nonl10n_target,$(1)) : $$(gb_Module_CURRENTTARGET))
endef
gb_Module_add_l10n_target =
endif endif
# vim: set noet ts=4 sw=4: # vim: set noet ts=4 sw=4:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This 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/.
*/
#include <algorithm>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <sstream>
#include <string>
#include <stdio.h>
using namespace std;
static const list<string> validargs = {
"linktarget",
"ilibtarget",
"cxxobjects",
"yaccobjects",
"objcobjects",
"objcxxobjects",
"asmobjects",
"gencobjects",
"gencxxobjects",
"cflags",
"cflagsappend",
"cxxflags",
"cxxflagsappend",
"objcflags",
"objcflagsappend",
"objcxxflags",
"objcxxflagsappend",
"defs",
"include",
"linked_libs",
"linked_static_libs"
};
int main(int argc, char** argv)
{
const string optsintro("--");
map<string, string> vartofile;
for(int i=1; i < argc; ++i)
{
const string arg(argv[i]);
if(arg.substr(0,2) != optsintro)
{
cerr << "Only option args starting with -- allowed." << endl;
return 1;
}
const size_t eqpos = arg.find("=", 2);
if(eqpos == string::npos)
{
cerr << "Only option args assigning with = allowed." << endl;
return 2;
}
const string argname(arg.substr(2, eqpos-2));
if(find(validargs.begin(), validargs.end(), argname) == validargs.end())
{
cerr << "Option" << argname << "invalid." << endl;
return 3;
}
vartofile[argname] = arg.substr(eqpos+1, string::npos);
}
cout << "{";
bool first(true);
for(auto& varandfile : vartofile)
{
if(first)
first =false;
else
cout << ", ";
string varupper(varandfile.first);
for(auto& c : varupper)
if(c != '_')
c = c-32;
ifstream filestream(varandfile.second.c_str());
stringstream contents;
contents << filestream.rdbuf();
filestream.close();
remove(varandfile.second.c_str());
string escapedcontents;
for(auto& c : contents.str())
{
if(c=='\\')
escapedcontents += "\\\\";
else if(c=='"')
escapedcontents += "\\\"";
else if(c=='\n')
continue;
else
escapedcontents += c;
}
cout << "\"" << varupper << "\": \"" << escapedcontents << "\"";
}
cout << "}" << endl;
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -14,26 +14,46 @@ import json ...@@ -14,26 +14,46 @@ import json
import os import os
import os.path import os.path
import tempfile import tempfile
import shutil
# these contortions seem unavoidable for windows
def getgbuildtesttools(testcase):
with open(os.path.join(os.environ['WORKDIR'], 'CustomTarget', 'solenv', 'gbuildtesttools.done'), 'r') as f:
gbuildtesttools = json.load(f)
testcase.make = gbuildtesttools['MAKE']
testcase.bash = gbuildtesttools['BASH']
testcase.gbuildtojson = gbuildtesttools['GBUILDTOJSON']
makeenvvars = ['MAKEOVERRIDES', 'MAKEFLAGS', 'MAKE_TERMERR', 'MAKE_TERMOUT', 'MAKELEVEL', 'MFLAGS']
def clearmakevars():
if 'LD_LIBRARY_PATH' in os.environ:
del(os.environ['LD_LIBRARY_PATH']) # built with ASAN; prevent that
for makeenvvar in makeenvvars:
if makeenvvar in os.environ:
del os.environ[makeenvvar]
class CheckGbuildToIde(unittest.TestCase): class CheckGbuildToIde(unittest.TestCase):
def setUp(self): def setUp(self):
getgbuildtesttools(self)
clearmakevars()
self.tempwork = tempfile.mkdtemp() self.tempwork = tempfile.mkdtemp()
if os.environ['OS'] == 'WNT':
self.tempworkmixed = self.tempwork.replace('\\','/')
else:
self.tempworkmixed = self.tempwork
def tearDown(self): def tearDown(self):
subprocess.check_call(['rm', '-rf', self.tempwork]) shutil.rmtree(self.tempwork)
def test_gbuildtoide(self): def test_gbuildtoide(self):
os.chdir(os.path.join(os.environ['SRCDIR'], 'solenv', 'qa', 'python', 'selftest')) os.makedirs(os.path.join(self.tempwork, 'LinkTarget', 'Executable'))
# make may find instdir/program/libfreebl3.so and fall over if that was shutil.copy(self.gbuildtojson, os.path.join(self.tempwork, 'LinkTarget', 'Executable'))
if 'LD_LIBRARY_PATH' in os.environ: (bashscripthandle, bashscriptname) = tempfile.mkstemp()
del(os.environ['LD_LIBRARY_PATH']) # built with ASAN; prevent that bashscript = os.fdopen(bashscripthandle, 'w', newline='\n')
make = os.environ['MAKE'] bashscript.write("set -e\n")
subprocess.check_call([make, 'gbuildtoide', 'WORKDIR=%s' % self.tempworkmixed]) bashscript.write("cd %s/solenv/qa/python/selftest\n" % os.environ['SRCDIR'])
bashscript.write("%s gbuildtoide WORKDIR=%s\n" % (self.make, self.tempwork.replace('\\', '/')))
bashscript.close()
subprocess.check_call([self.bash, bashscriptname.replace('\\', '/')])
os.remove(bashscriptname)
jsonfiles = os.listdir(os.path.join(self.tempwork, 'GbuildToIde', 'Library')) jsonfiles = os.listdir(os.path.join(self.tempwork, 'GbuildToIde', 'Library'))
gbuildlibs = [] gbuildlibs = []
for jsonfilename in jsonfiles: for jsonfilename in jsonfiles:
...@@ -41,7 +61,7 @@ class CheckGbuildToIde(unittest.TestCase): ...@@ -41,7 +61,7 @@ class CheckGbuildToIde(unittest.TestCase):
gbuildlibs.append(json.load(f)) gbuildlibs.append(json.load(f))
foundlibs = set() foundlibs = set()
for lib in gbuildlibs: 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'])) self.assertEqual(set(lib.keys()), set(['ASMOBJECTS', 'CFLAGS', 'CFLAGSAPPEND', 'CXXFLAGS', 'CXXFLAGSAPPEND', 'CXXOBJECTS', 'DEFS', 'GENCOBJECTS', 'GENCXXOBJECTS', 'ILIBTARGET', 'INCLUDE', 'LINKED_LIBS', 'LINKED_STATIC_LIBS', 'LINKTARGET', 'OBJCFLAGS', 'OBJCFLAGSAPPEND', 'OBJCOBJECTS', 'OBJCXXFLAGS', 'OBJCXXFLAGSAPPEND', 'OBJCXXOBJECTS', 'YACCOBJECTS']))
if lib['LINKTARGET'].find('gbuildselftestdep') != -1: if lib['LINKTARGET'].find('gbuildselftestdep') != -1:
foundlibs.add('gbuildselftestdep') foundlibs.add('gbuildselftestdep')
elif lib['LINKTARGET'].find('gbuildselftest') != -1: elif lib['LINKTARGET'].find('gbuildselftest') != -1:
...@@ -50,8 +70,8 @@ class CheckGbuildToIde(unittest.TestCase): ...@@ -50,8 +70,8 @@ class CheckGbuildToIde(unittest.TestCase):
self.assertIn('gbuildselftestdep', lib['LINKED_LIBS'].split()) self.assertIn('gbuildselftestdep', lib['LINKED_LIBS'].split())
self.assertIn('solenv/qa/python/selftest/selftestobject', lib['CXXOBJECTS'].split()) self.assertIn('solenv/qa/python/selftest/selftestobject', lib['CXXOBJECTS'].split())
self.assertIn('-DGBUILDSELFTESTDEF', lib['DEFS'].split()) self.assertIn('-DGBUILDSELFTESTDEF', lib['DEFS'].split())
self.assertIn('-DGBUILDSELFTESTCXXFLAG', lib['CXXFLAGS'].split()) self.assertIn('-DGBUILDSELFTESTCXXFLAG', lib['CXXFLAGSAPPEND'].split())
self.assertIn('-DGBUILDSELFTESTCFLAG', lib['CFLAGS'].split()) self.assertIn('-DGBUILDSELFTESTCFLAG', lib['CFLAGSAPPEND'].split())
else: else:
self.assertTrue(False) self.assertTrue(False)
self.assertEqual(foundlibs, set(['gbuildselftest', 'gbuildselftestdep'])) self.assertEqual(foundlibs, set(['gbuildselftest', 'gbuildselftestdep']))
...@@ -70,6 +90,58 @@ class CheckGbuildToIde(unittest.TestCase): ...@@ -70,6 +90,58 @@ class CheckGbuildToIde(unittest.TestCase):
self.assertEqual(foundexes, set(['gbuildselftestexe'])) self.assertEqual(foundexes, set(['gbuildselftestexe']))
self.assertEqual(len(foundexes), 1) self.assertEqual(len(foundexes), 1)
class CheckGbuildToIdeModules(unittest.TestCase):
def setUp(self):
getgbuildtesttools(self)
clearmakevars()
self.tempwork = tempfile.mkdtemp()
self.tempsrc = tempfile.mkdtemp()
self.srcdir = os.environ['SRCDIR']
if os.environ['OS'] == 'WNT':
self.tempworkmixed = self.tempwork.replace('\\','/')
self.tempsrcmixed = self.tempsrc.replace('\\','/')
self.srcdirnative = self.srcdir.replace('/','\\')
else:
self.tempworkmixed = self.tempwork
self.tempsrcmixed = self.tempsrc
self.srcdirnative = self.srcdir
shutil.copyfile(os.path.join(self.srcdirnative, 'config_host.mk'), os.path.join(self.tempsrc, 'config_host.mk'))
shutil.copyfile(os.path.join(self.srcdirnative, 'config_host_lang.mk'), os.path.join(self.tempsrc, 'config_host_lang.mk'))
shutil.copyfile(os.path.join(self.srcdirnative, 'Repository.mk'), os.path.join(self.tempsrc, 'Repository.mk'))
shutil.copyfile(os.path.join(self.srcdirnative, 'RepositoryExternal.mk'), os.path.join(self.tempsrc, 'RepositoryExternal.mk'))
shutil.copyfile(os.path.join(self.srcdirnative, 'RepositoryFixes.mk'), os.path.join(self.tempsrc, 'RepositoryFixes.mk'))
shutil.copytree(os.path.join(self.srcdirnative, 'config_host'), os.path.join(self.tempsrc, 'config_host'))
print('copytree from _%s_ to _%s_' % (os.path.join(self.srcdirnative, 'solenv').replace('\\', '#').replace('/', '!'), os.path.join(self.tempsrc, 'solenv').replace('\\', '#').replace('/', '!')))
shutil.copytree(os.path.join(self.srcdirnative, 'solenv'), os.path.join(self.tempsrc, 'solenv'))
def tearDown(self):
shutil.rmtree(self.tempsrc)
shutil.rmtree(self.tempwork)
def test_gbuildtoide(self):
blacklisted_modules = ['compilerplugins', 'cli_ure', 'dictionaries', 'bridges', 'helpcompiler', 'helpcontent2', 'icon-themes', 'sal', 'shell', 'cppu', 'cppuhelper', 'cpputools', 'extensions', 'external', 'i18npool', 'javaunohelper', 'jurt', 'lingucomponent', 'odk', 'scaddins', 'solenv', 'stoc', 'tools', 'tranlations', 'writerfilter']
modules = ['accessibility', 'android', 'animations', 'apple_remote', 'avmedia', 'basctl', 'basegfx', 'basic', 'bean', 'canvas', 'chart2', 'codemaker', 'comphelper', 'cppcanvas', 'cui', 'dbaccess', 'desktop', 'drawinglayer', 'dtrans', 'editeng', 'embeddedobj', 'embedserv', 'eventattacher', 'extras', 'filter', 'forms', 'formula', 'fpicker', 'framework', 'hwpfilter', 'i18nlangtag', 'i18nutil', 'idl', 'idlc', 'instsetoo_native', 'io', 'ios', 'jvmaccess', 'jvmfwk', 'l10ntools', 'librelogo', 'libreofficekit', 'linguistic', 'lotuswordpro', 'mysqlc', 'nlpsolver', 'o3tl', 'offapi', 'officecfg', 'onlineupdate', 'oovbaapi', 'oox', 'opencl', 'package', 'postprocess', 'pyuno', 'registry', 'remotebridges', 'reportbuilder', 'reportdesign', 'ridljar', 'rsc', 'salhelper', 'sax', 'sc', 'sccomp', 'scp2', 'scripting', 'sd', 'sdext', 'setup_native', 'sfx2', 'slideshow', 'smoketest', 'soltools', 'sot', 'starmath', 'store', 'svgio', 'svl', 'svtools', 'svx', 'sw', 'swext', 'sysui', 'test', 'testtools', 'toolkit', 'tubes', 'ucb', 'ucbhelper', 'udkapi', 'uitest', 'UnoControls', 'unodevtools', 'unoidl', 'unoil', 'unotest', 'unotools', 'unoxml', 'ure', 'uui', 'vbahelper', 'vcl', 'winaccessibility', 'wizards', 'writerperfect', 'xmerge', 'xmlhelp', 'xmloff', 'xmlreader', 'xmlscript', 'xmlsecurity']
for module in modules:
shutil.rmtree(self.tempwork)
os.makedirs(os.path.join(self.tempwork, 'LinkTarget', 'Executable'))
shutil.copy(self.gbuildtojson, os.path.join(self.tempwork, 'LinkTarget', 'Executable'))
if module != 'solenv':
shutil.copytree(os.path.join(os.environ['SRCDIR'], module), os.path.join(self.tempsrc, module))
(bashscripthandle, bashscriptname) = tempfile.mkstemp()
bashscript = os.fdopen(bashscripthandle, 'w', newline='\n')
bashscript.write("set -e\n")
bashscript.write("cd %s/%s\n" % (self.tempsrc.replace('\\','/'), module))
bashscript.write("%s gbuildtoide WORKDIR=%s SRCDIR=%s\n" % (self.make, self.tempwork.replace('\\', '/'), self.tempsrc.replace('\\','/')))
bashscript.close()
subprocess.check_call([self.bash, bashscriptname.replace('\\', '/')])
os.remove(bashscriptname)
jsonfiles = os.listdir(os.path.join(self.tempwork, 'GbuildToIde', 'Library'))
gbuildlibs = []
for jsonfilename in jsonfiles:
with open(os.path.join(self.tempwork, 'GbuildToIde', 'Library', jsonfilename), 'r') as f:
gbuildlibs.append(json.load(f))
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment