The original motivation for this came when I tried to combine two decorators:
@expectedFailureDarwin @expectedFailureLinux
into a single decorator:
@expectedFailureAll(oslist=...)
This results in a really ugly syntax, because @expectedFailureDarwin calls getDarwinOsTriples() which is itself a list. So you would have to do something like this:
@expectedFailureAll(oslist=getDarwinOsTriples()+["linux"])
Not the end of the world, but not ideal either. Then I remembered that we've all had this ugliness surrounding the translation of python api calls such as sys.name, os.platform, and target names and host names into something consistent, so it occurred to me that many things would become cleaner and more elegant if we had actual enums for everything, and a centralized place where we can convert between enums and strings or whatever else we need.
So this patch introduces two enums. target and host, updates the common decorator to support these values from these enums, and changes two decorators to using these new values as a proof of concept.
One nice thing about these enums is that we can make standardized enum values for "combinations" of targets or hosts where it makes sense (such as is the case of with darwin, which is why the getDarwinOsTriples() function existed in the first place. So in that sense it works similarly to a flags enum in C / C++.
Eventually it would be nice if we could start using these enums all over the codebase instead of using strings everywhere, but this patch does not attempt to solve that problem.