aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/gcs_test
diff options
context:
space:
mode:
authorGravatar Xiaoqiang Zheng <zhengxq@google.com>2016-10-28 10:29:28 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-10-28 11:38:26 -0700
commite2d51a87f0727f8537b46048d8241aeebb6e48d6 (patch)
tree64c075f59bae00706a009e5d1ed15aaff6adc6ff /tensorflow/tools/gcs_test
parentf80ef2d696456c970956f47e7d5aa88bc7ccbdce (diff)
Merge changes from github.
Change: 137532946
Diffstat (limited to 'tensorflow/tools/gcs_test')
-rw-r--r--tensorflow/tools/gcs_test/Dockerfile2
-rwxr-xr-xtensorflow/tools/gcs_test/gcs_smoke_wrapper.sh11
-rw-r--r--tensorflow/tools/gcs_test/python/gcs_smoke.py42
3 files changed, 40 insertions, 15 deletions
diff --git a/tensorflow/tools/gcs_test/Dockerfile b/tensorflow/tools/gcs_test/Dockerfile
index 0abe3d6304..782a63f77f 100644
--- a/tensorflow/tools/gcs_test/Dockerfile
+++ b/tensorflow/tools/gcs_test/Dockerfile
@@ -17,7 +17,7 @@ RUN ./install_google_cloud_sdk.bash --disable-prompts --install-dir=/var/gcloud
# Install nightly TensorFlow pip
RUN pip install \
- https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl
+ https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl
# Copy test files
RUN mkdir -p /gcs-smoke/python
diff --git a/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh b/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh
index 68800d67af..2ce0fb394f 100755
--- a/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh
+++ b/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh
@@ -81,7 +81,6 @@ fi
cat ${LOG_FILE}
echo ""
-
# Clean up the newly created tfrecord file in GCS bucket.
# First, activate gcloud service account
"${GCLOUD_BIN}" auth activate-service-account \
@@ -96,13 +95,3 @@ fi
"${GSUTIL_BIN}" rm "${NEW_TFREC_URL}" && \
echo "Cleaned up new tfrecord file in GCS: ${NEW_TFREC_URL}" || \
die "FAIL: Unable to clean up new tfrecord file in GCS: ${NEW_TFREC_URL}"
-
-# Also clean up newly created GCS dir.
-NEW_DIR_URL=$(grep "Creating dir" "${LOG_FILE}" | \
- awk '{print $NF}')
-if [[ -z ${NEW_DIR_URL} ]]; then
- die "FAIL: Unable to determine the URL to the new directory created in GCS."
-fi
-"${GSUTIL_BIN}" rm -r "${NEW_DIR_URL}" && \
- echo "Cleaned up new directory created in GCS: ${NEW_DIR_URL}" || \
- die "FAIL: Unable to clean up new directory created in GCS: ${NEW_DIR_URL}"
diff --git a/tensorflow/tools/gcs_test/python/gcs_smoke.py b/tensorflow/tools/gcs_test/python/gcs_smoke.py
index 0e0018fc2f..23f45a9886 100644
--- a/tensorflow/tools/gcs_test/python/gcs_smoke.py
+++ b/tensorflow/tools/gcs_test/python/gcs_smoke.py
@@ -35,7 +35,6 @@ flags.DEFINE_integer("num_examples", 10, "Number of examples to generate")
FLAGS = flags.FLAGS
-
def create_examples(num_examples, input_mean):
"""Create ExampleProto's containg data."""
ids = np.arange(num_examples).reshape([num_examples, 1])
@@ -64,12 +63,48 @@ def create_dir_test():
print("%s directory exists: %s" % (dir_name, dir_exists))
# List contents of just created directory.
- starttime = int(round(time.time() * 1000))
print("Listing directory %s." % dir_name)
+ starttime = int(round(time.time() * 1000))
print(file_io.list_directory(dir_name))
elapsed = int(round(time.time() * 1000)) - starttime
print("Listed directory %s in %s milliseconds" % (dir_name, elapsed))
+ # Delete directory.
+ print("Deleting directory %s." % dir_name)
+ starttime = int(round(time.time() * 1000))
+ file_io.delete_recursively(dir_name)
+ elapsed = int(round(time.time() * 1000)) - starttime
+ print("Deleted directory %s in %s milliseconds" % (dir_name, elapsed))
+
+def create_object_test():
+ """Verifies file_io's object manipulation methods ."""
+ starttime = int(round(time.time() * 1000))
+ dir_name = "%s/tf_gcs_test_%s" % (FLAGS.gcs_bucket_url, starttime)
+ print("Creating dir %s." % dir_name)
+ file_io.create_dir(dir_name)
+
+ # Create a file in this directory.
+ file_name = "%s/test_file.txt" % dir_name
+ print("Creating file %s." % file_name)
+ file_io.write_string_to_file(file_name, "test file creation.")
+
+ list_files_pattern = "%s/test_file*.txt" % dir_name
+ print("Getting files matching pattern %s." % list_files_pattern)
+ files_list = file_io.get_matching_files(list_files_pattern)
+ print(files_list)
+
+ assert len(files_list) == 1
+ assert files_list[0] == file_name
+
+ # Cleanup test files.
+ print("Deleting file %s." % file_name)
+ file_io.delete_file(file_name)
+
+ # Delete directory.
+ print("Deleting directory %s." % dir_name)
+ file_io.delete_recursively(dir_name)
+
+
if __name__ == "__main__":
# Sanity check on the GCS bucket URL.
if not FLAGS.gcs_bucket_url or not FLAGS.gcs_bucket_url.startswith("gs://"):
@@ -132,4 +167,5 @@ if __name__ == "__main__":
print("Successfully caught the expected OutOfRangeError while "
"reading one more record than is available")
- create_dir_test()
+ create_dir_test()
+ create_object_test()