Issue metadata
Sign in to add a comment
|
Eliminate duplication of Makefiles in policy autotests |
||||||||||||||||||||||||
Issue description
The following Makefiles are identical (except for year of creation):
policy_ChromeOsLockOnIdleSuspend/src/Makefile
policy_CookiesAllowedForUrls/src/Makefile
policy_CookiesBlockedForUrls/src/Makefile
policy_CookiesSessionOnlyForUrls/src/Makefile
policy_DisableScreenshots/src/Makefile
policy_EditBookmarksEnabled/src/Makefile
policy_ForceGoogleSafeSearch/src/Makefile
policy_ForceYouTubeSafetyMode/src/Makefile
policy_ImagesAllowedForUrls/src/Makefile
policy_ImagesBlockedForUrls/src/Makefile
policy_JavaScriptAllowedForUrls/src/Makefile
policy_JavaScriptBlockedForUrls/src/Makefile
policy_ManagedBookmarks/src/Makefile
policy_NotificationsAllowedForUrls/src/Makefile
policy_NotificationsBlockedForUrls/src/Makefile
policy_PluginsAllowedForUrls/src/Makefile
policy_PluginsBlockedForUrls/src/Makefile
policy_PopupsAllowedForUrls/src/Makefile
policy_PopupsBlockedForUrls/src/Makefile
policy_PowerManagementIdleSettings/src/Makefile
policy_ProxySettings/src/Makefile
policy_RestoreOnStartupURLs/src/Makefile
policy_URLBlacklist/src/Makefile
policy_URLWhitelist/src/Makefile
All these autotests inherit from EnterprisePolicyTest in enterprise_policy_base.py. It should be possible to keep one template Makefile in cros/enterprise/Makefile, and copy this to the src/ directory for each autotest during setup.
I tried to modify the setup method like so:
def setup(self):
if not os.path.isdir(self.srcdir):
os.mkdir(self.srcdir)
makefile = 'Makefile'
make_src = os.path.join(os.path.dirname(__file__), makefile)
make_dst = os.path.join(self.srcdir, makefile)
shutil.copyfile(make_src, make_dst)
os.chdir(self.srcdir)
utils.make()
Sadly this didn't work.
,
Oct 30 2017
Yes, I ran into the same issue when trying that same fix a while back :) Modifying this fell off our radar in the face of more pressing issues, but perhaps it's worth revisiting. Adding people from Infra: what's the best way to set this up? We have Autotests which build the same Makefile across multiple tests (the Fake DMS server used in policy tests). We want to remove the code duplication and stop building the same code for every setup().
,
Oct 31 2017
Possibly dumb idea: one makefile, many symlinks. That only solves code duplication, not performance.
,
Nov 13 2017
,
Nov 14 2017
you could have chromeos-base/protofiles build & install the python files as part of its own package, then there's no need for any autotest to generate them on the fly. seems like that package is only part of dev/test images, so shouldn't be an issue.
,
Dec 14 2017
,
May 2 2018
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 Deleted