New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773006 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 793333
Owner: ----
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Eliminate duplication of Makefiles in policy autotests

Project Member Reported by achuith@chromium.org, Oct 9 2017

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.
 

Comment 1 Deleted

Cc: akes...@chromium.org dshi@chromium.org sbasi@chromium.org
Labels: ent-autotest
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().
Cc: vapier@chromium.org
Possibly dumb idea: one makefile, many symlinks. That only solves code duplication, not performance.


Comment 4 Deleted

Cc: dchan@chromium.org
 Issue 629361  has been merged into this issue.

Comment 6 by vapier@chromium.org, 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.
Mergedinto: 793333
Status: Duplicate (was: Untriaged)
Labels: -ent-autotest ent-automation

Sign in to add a comment