-
Notifications
You must be signed in to change notification settings - Fork 74.4k
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
Add option for build more python tests in Cmake #11853
Add option for build more python tests in Cmake #11853
Conversation
raymondxyang
commented
Jul 28, 2017
- Add option tensorflow_BUILD_MORE_PYTHON_TESTS for testing some major packages under contrib directory
- Tested, fixed and enabled some UTs on Windows/Linux
* Fix regex match for Windows * Fix compatibility issue with Python 3.x
…o windows-enable-testcases
* Clean code and resolve conflicts
Can one of the admins verify this patch? |
@mrry could you take a look at this, please? |
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.
Thanks for improving the test coverage! Some comments and questions about the changes follow....
@@ -148,14 +148,28 @@ if (tensorflow_BUILD_PYTHON_TESTS) | |||
"${tensorflow_source_dir}/tensorflow/python/training/*_test.py" | |||
"${tensorflow_source_dir}/tensorflow/contrib/data/*_test.py" | |||
"${tensorflow_source_dir}/tensorflow/contrib/factorization/*_test.py" | |||
"${tensorflow_source_dir}/tensorflow/contrib/keras/python/keras/integration_test.py" |
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.
Was this test failing? It would be better to leave it here if not, so that it continues to be part of our presubmits...
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.
AssertionError on local Windows build (GPU) recorded when committed. Passed latest Jenkins tensorflow/master build (CPU).. So I will add it back since Jenkins only run CPU build
@@ -195,7 +195,7 @@ def func_dump(func): | |||
Returns: | |||
A tuple `(code, defaults, closure)`. | |||
""" | |||
code = marshal.dumps(func.__code__).decode('raw_unicode_escape') | |||
code = marshal.dumps(func.__code__).replace(b'\\',b'/').decode('raw_unicode_escape') |
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's going on here? It doesn't seem generally safe to do this, but I'm not familiar with this code...
constants.COLLECTION_DEF_KEY_FOR_INPUT_FEATURE_KEYS)) | ||
self.assertItemsEqual( | ||
['bogus_lookup', 'feature'], | ||
[x.decode("utf-8") for x in graph.get_collection( |
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.
Does this work on Python 2.x with non-Unicode strings?
It might be better to use the compat.py
conversion functions to canonicalize these to bytes (or str) objects....
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.
Fixed.
@@ -63,32 +63,33 @@ def _get_default_signature(self, export_meta_filename): | |||
signatures_any[0].Unpack(signatures) | |||
default_signature = signatures.default_signature | |||
return default_signature | |||
|
|||
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 the linter will complain about the added space here and on L85... delete it, please.
def _assert_export(self, export_monitor, export_dir, expected_signature): | ||
self.assertTrue(gfile.Exists(export_dir)) | ||
# Only the written checkpoints are exported. | ||
self.assertTrue( | ||
saver.checkpoint_exists(export_dir + '00000001/export'), | ||
saver.checkpoint_exists(os.path.join( export_dir, '00000001', 'export')), |
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.
Delete the space after join(
here and on L73, L75, and L77.
self.assertFalse(saver.checkpoint_exists(export_dir + '00000000/export')) | ||
self.assertTrue(saver.checkpoint_exists(export_dir + '00000010/export')) | ||
# Catch exception for non-existing path | ||
# with self.assertRaises(errors.NotFoundError): |
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.
Delete this commented-out line.
# Validate the signature | ||
signature = self._get_default_signature(export_dir + '00000010/export.meta') | ||
signature = self._get_default_signature( | ||
os.path.join( export_dir, '00000010', 'export.meta')) |
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.
Delete the space after join(
.
compat.as_str_any(path.path)) | ||
# Modify the path object for RegEx match for Windows Paths | ||
match = re.match("^" + compat.as_str_any(base_dir).replace('\\','/') + "/(\\d+)$", | ||
compat.as_str_any(path.path).replace('\\','/')) |
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.
This substitution doesn't seem safe on POSIX... what if there is a \
character in a path? Perhaps you should guard this with an if os.name == 'nt':
block.
@@ -301,7 +301,8 @@ def export(self, | |||
if exports_to_keep: | |||
# create a simple parser that pulls the export_version from the directory. | |||
def parser(path): | |||
match = re.match("^" + export_dir_base + "/(\\d{8})$", path.path) | |||
match = re.match("^" + export_dir_base.replace('\\','/') + "/(\\d{8})$", | |||
path.path.replace('\\','/')) |
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.
Same comment as before... wrap this in an if os.name == 'nt':
block.
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.
All regex fixed.. thanks for the advice Derek
@tensorflow-jenkins test this please |
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.
LGTM. Thanks for the contribution!
Hi @mrry
Not sure what happened.. and cannot re-produce on local/own jennkins bazel build.. would you help me look into the log or help me getting the detailed info? |
@tensorflow-jenkins test this please |
Hi @rmlarsen I've added a missing module related to the failure. May I have it re-tested by jenkins? |
@tensorflow-jenkins test this please. |
The test |
@tensorflow-jenkins test this please |
1 similar comment
@tensorflow-jenkins test this please |
Thanks for the contribution! |