Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py
diff --git a/tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py b/tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a2750a6f9e847c8573dea62aed0355a13ae420a
--- /dev/null
+++ b/tools/telemetry/third_party/coverage/tests/farm/run/src/showtrace.py
@@ -0,0 +1,26 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
+
+# Show the current frame's trace function, so that we can test what the
+# command-line options do to the trace function used.
+
+import sys
+
+# Show what the trace function is. If a C-based function is used, then f_trace
+# may be None.
+trace_fn = sys._getframe(0).f_trace
+if trace_fn is None:
+ trace_name = "None"
+else:
+ # Get the name of the tracer class. Py3k has a different way to get it.
+ try:
+ trace_name = trace_fn.im_class.__name__
+ except AttributeError:
+ try:
+ trace_name = trace_fn.__self__.__class__.__name__
+ except AttributeError:
+ # A C-based function could also manifest as an f_trace value
+ # which doesn't have im_class or __self__.
+ trace_name = trace_fn.__class__.__name__
+
+print("%s %s" % (sys.argv[1], trace_name))

Powered by Google App Engine
This is Rietveld 408576698