Index: third_party/grpc/test/core/support/env_test.c |
diff --git a/third_party/tcmalloc/chromium/src/base/synchronization_profiling.h b/third_party/grpc/test/core/support/env_test.c |
similarity index 67% |
copy from third_party/tcmalloc/chromium/src/base/synchronization_profiling.h |
copy to third_party/grpc/test/core/support/env_test.c |
index cf02c218a111806189f71f7b528a83b5ceb164a4..69aebcc918cbf19bf0bd0939226406ad3090c545 100644 |
--- a/third_party/tcmalloc/chromium/src/base/synchronization_profiling.h |
+++ b/third_party/grpc/test/core/support/env_test.c |
@@ -1,4 +1,6 @@ |
-/* Copyright (c) 2010, Google Inc. |
+/* |
+ * |
+ * Copyright 2015, Google Inc. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
@@ -27,24 +29,36 @@ |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
- * --- |
- * Author: Chris Ruemmler |
*/ |
-#ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
-#define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |
+#include <stdio.h> |
+#include <string.h> |
+ |
+#include <grpc/support/alloc.h> |
+#include <grpc/support/log.h> |
+ |
+#include "src/core/support/env.h" |
+#include "src/core/support/string.h" |
+#include "test/core/util/test_config.h" |
-#include "base/basictypes.h" |
+#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x) |
-namespace base { |
+static void test_setenv_getenv(void) { |
+ const char *name = "FOO"; |
+ const char *value = "BAR"; |
+ char *retrieved_value; |
-// We can do contention-profiling of SpinLocks, but the code is in |
-// mutex.cc, which is not always linked in with spinlock. Hence we |
-// provide a weak definition, which are used if mutex.cc isn't linked in. |
+ LOG_TEST_NAME("test_setenv_getenv"); |
+ |
+ gpr_setenv(name, value); |
+ retrieved_value = gpr_getenv(name); |
+ GPR_ASSERT(retrieved_value != NULL); |
+ GPR_ASSERT(strcmp(value, retrieved_value) == 0); |
+ gpr_free(retrieved_value); |
+} |
-// Submit the number of cycles the spinlock spent contending. |
-ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); |
-extern void SubmitSpinLockProfileData(const void *contendedlock, |
- int64 wait_cycles) {} |
+int main(int argc, char **argv) { |
+ grpc_test_init(argc, argv); |
+ test_setenv_getenv(); |
+ return 0; |
} |
-#endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ |