-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workloads: Add support for UIBench #938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to keep my patch as light as possible. If required, I could also modify PackageHandler
as described in the following comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to do your suggested changes to PackageHandler
so that your solution can be utilised by future workloads rather than having to do it within the workload itself.
wa/workloads/uibench/__init__.py
Outdated
raise ValueError(msg.format(self.activity, activities)) | ||
self.apk.apk_info.activity = '.{}'.format(self.activity) | ||
super(Uibench, self).setup(context) | ||
time.sleep(self.duration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uibench might not be the most familiar workload to developers. Could we be more helpful by adding a short description of the workload and provide a url (https://android.googlesource.com/platform/frameworks/base.git/+/master/tests/UiBench/) for reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the current version?
Instead of having an approach where we manually write to an instance variable ( |
Will need to rebase for the |
The methods are methods for a generic "workload" (or more generally job); Their parameters should not tie them to anything specific such as and Android activity. Please remove this chage. |
I have changed:
All of these methods deal exclusively with Android targets and their APKs. All APKs have activities:
Under these conditions, adding a feature dealing with an inherent part of any Android application to a set of classes dealing with Android applications seems reasonable; how is this change affecting the genericity of these classes or of their methods? Please note that this PR does not modify |
The
To me, this neither cleaner, nor more robust. And since the parameter that is being passed is an attribute of the object, and so is already available inside the method it is being passed to, I really don't see what problem this change is solving that justifies the inheritance hierarchy weirdness. For |
You are right about the The "cleaner and more robust" comment referred to "calling a method with an argument" vs "calling a method without argument after having overwritten an instance variable controlling the behaviour of that method" which is what I was doing previously in this PR. I keep this point of view, however, it's now obvious that the latest change concerns more than just that. In particular, the reason why I had to modify the
Except from ( |
You were modifying the state of an object form inside a method of that object; said state was then being used by another method of that object. Conceptually, there is nothing wrong with that -- that's what objects with methods are for (vs just having functions where the entire state is passed as arguments). In practice I agree that the old solution was not the most elegant. However, I still prefer it over this one -- at least, in that case, the cruftiness was contained within one workload. The issue here is that our model for how we run apk workloads does not fit particularly well how this workload needs to be run. If this is a one-off, I am happy to live with a bit of cruft, as long as it is contained with this workload. If this is a wider issue with the model, then perhaps it needs to be reexamined and wider, more systematic, changes made. However I'd rather avoid making quick changes to the framework that weaken its conceptual integrity for the sake of making implementation of one workload a little cleaner.
I'm not sure I'm following the reasoning here. There is no mismatch in the meaning of
Just those two. My point was that you could, e.g. call |
As stated in the quote from the official Android documentation I post above, activities are an integral and important part of Android applications. For this reason, The ways I was trying to patch this support into the code were arguably hacky, I agree with that. However, this is not a one-off to satisfy the exotic requirements of a workload! To illustrate this, this PR is also not the first one facing this limitation of the framework e.g. #720 had the same requirements.
This is exactly why this workload for UIBench uses activities: if you try launching the app (which effectively means starting in the default activity), you will be presented with a menu of all the "tests" the suite provides. However, the application provides an activity (entrypoint) for each one of these tests! Isn't it cleaner to ask the app to start a given test directly, by passing the name of the corresponding activity to
I had considered passing the
I had misinterpreted " |
The issue highlighted that PR has already been addressed (pretty much in the way that the PR was solving it) by 753786a.
Yes, I agree it would be better to use the activity directly, and that's what we've done in the past for the workloads that supported this. But so far, we could get way with launching them from setup. The issue, as I understand it, is not specifying which activity to launch (which is already supported); but having it launched as part of
FWIW, we do document the intended functionality of each method here: https://workload-automation.readthedocs.io/en/latest/api/workload.html |
If the activity field of an instance of ApkWorkload does not the '.' character, it is assumed that it is in the Java namespace of the application. This is similar to how activities can be referred to with relative paths: com.domain.app/.activity instead of com.domain.app/com.domain.app.activity
Add support for Android's UIBench suite of tests as a WA workload.
Rebased as required to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth adding in validation of the activity using the functionality that was added in ARM-software/devlib#357?
Yes and initially (before I rebased it), it was done in this PR. The reason why I haven't added it back is that I believe this test should be added in the Therefore, a test such as My idea was to investigate that and open another PR to fix the activity regex so that we can add the check when running a given activity. This check isn't required for the functionality that this PR attempts to introduce, though. In particular as it's not present in the current IMO, the main advantage of that check (and the reason why I had implemented it in the first place) is that the error message could then state which activities are accepted (as opposed to the current error message coming back from the target, simply stating that the activity is invalid). |
Ok that seems fair enough, in that case happy to merge this as is until the best way to perform the validation has been decided. |
Add support for Android's UIBench (AOSP -
frameworks/base/tests/UIBench
) suite of tests as a WA workload.Please note that this is based on ARM-software/devlib#357.