MCPcopy Create free account
hub / github.com/boostorg/build / maybe_do_diff

Method maybe_do_diff

v2/test/BoostBuild.py:753–775  ·  view source on GitHub ↗
(self, actual, expected)

Source from the content-addressed store, hash-verified

751 self.fail_test(1)
752
753 def maybe_do_diff(self, actual, expected):
754 if os.environ.get("DO_DIFF"):
755 e = tempfile.mktemp("expected")
756 a = tempfile.mktemp("actual")
757 f = open(e, "w")
758 f.write(expected)
759 f.close()
760 f = open(a, "w")
761 f.write(actual)
762 f.close()
763 print("DIFFERENCE")
764 # Current diff should return 1 to indicate 'different input files'
765 # but some older diff versions may return 0 and depending on the
766 # exact Python/OS platform version, os.system() call may gobble up
767 # the external process's return code and return 0 itself.
768 if os.system('diff -u "%s" "%s"' % (e, a)) not in [0, 1]:
769 print('Unable to compute difference: diff -u "%s" "%s"' % (e, a
770 ))
771 os.unlink(e)
772 os.unlink(a)
773 else:
774 print("Set environmental variable 'DO_DIFF' to examine the "
775 "difference.")
776
777 # Internal methods.
778 def adjust_lib_name(self, name):

Callers 1

run_build_systemMethod · 0.95

Calls 3

getMethod · 0.80
unlinkMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected