aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--src/core/support/cpu_posix.c4
-rw-r--r--src/core/transport/chttp2/timeout_encoding.c17
-rw-r--r--test/core/transport/chttp2/timeout_encoding_test.c7
-rw-r--r--tools/run_tests/build_artifact_csharp.bat12
-rwxr-xr-xtools/run_tests/build_artifacts.py5
6 files changed, 36 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 471649d7a0..cc70659661 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,3 +82,6 @@ DerivedData
# Podfile.lock and the workspace file are tracked, to ease deleting them. That's
# needed to trigger "pod install" to rerun the preinstall commands.
Pods/
+
+# Artifacts directory
+artifacts/
diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c
index 5edb87d67f..8f01c284ca 100644
--- a/src/core/support/cpu_posix.c
+++ b/src/core/support/cpu_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,7 @@ static long ncpus = 0;
static void init_ncpus() {
ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpus < 1 || ncpus > UINT32_MAX) {
+ if (ncpus < 1 || ncpus > INT32_MAX) {
gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
ncpus = 1;
}
diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/transport/chttp2/timeout_encoding.c
index 8cbf987a42..a6f7081d21 100644
--- a/src/core/transport/chttp2/timeout_encoding.c
+++ b/src/core/transport/chttp2/timeout_encoding.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -137,7 +137,7 @@ static int is_all_whitespace(const char *p) {
}
int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout) {
- uint32_t x = 0;
+ int32_t x = 0;
const uint8_t *p = (const uint8_t *)buffer;
int have_digit = 0;
/* skip whitespace */
@@ -145,13 +145,16 @@ int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout) {
;
/* decode numeric part */
for (; *p >= '0' && *p <= '9'; p++) {
- uint32_t xp = x * 10u + (uint32_t)*p - (uint32_t)'0';
+ int32_t digit = (int32_t)(*p - (uint8_t)'0');
have_digit = 1;
- if (xp < x) {
- *timeout = gpr_inf_future(GPR_CLOCK_REALTIME);
- return 1;
+ /* spec allows max. 8 digits, but we allow values up to 1,000,000,000 */
+ if (x >= (100 * 1000 * 1000)) {
+ if (x != (100 * 1000 * 1000) || digit != 0) {
+ *timeout = gpr_inf_future(GPR_CLOCK_REALTIME);
+ return 1;
+ }
}
- x = xp;
+ x = x * 10 + digit;
}
if (!have_digit) return 0;
/* skip whitespace */
diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c
index ba6c3191f1..f0e8ec386f 100644
--- a/test/core/transport/chttp2/timeout_encoding_test.c
+++ b/test/core/transport/chttp2/timeout_encoding_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -126,8 +126,13 @@ void test_decoding(void) {
decode_suite('S', gpr_time_from_seconds);
decode_suite('M', gpr_time_from_minutes);
decode_suite('H', gpr_time_from_hours);
+ assert_decodes_as("1000000000S",
+ gpr_time_from_seconds(1000 * 1000 * 1000, GPR_TIMESPAN));
assert_decodes_as("1000000000000000000000u",
gpr_inf_future(GPR_CLOCK_REALTIME));
+ assert_decodes_as("1000000001S", gpr_inf_future(GPR_CLOCK_REALTIME));
+ assert_decodes_as("2000000001S", gpr_inf_future(GPR_CLOCK_REALTIME));
+ assert_decodes_as("9999999999S", gpr_inf_future(GPR_CLOCK_REALTIME));
}
void test_decoding_fails(void) {
diff --git a/tools/run_tests/build_artifact_csharp.bat b/tools/run_tests/build_artifact_csharp.bat
new file mode 100644
index 0000000000..33dc8c25ae
--- /dev/null
+++ b/tools/run_tests/build_artifact_csharp.bat
@@ -0,0 +1,12 @@
+@rem Builds C# artifacts on Windows
+
+@call vsprojects\build_vs2013.bat %* || goto :error
+
+mkdir artifacts
+copy /Y vsprojects\Release\grpc_csharp_ext.dll artifacts || copy /Y vsprojects\x64\Release\grpc_csharp_ext.dll artifacts || goto :error
+
+goto :EOF
+
+:error
+echo Failed!
+exit /b %errorlevel%
diff --git a/tools/run_tests/build_artifacts.py b/tools/run_tests/build_artifacts.py
index 0d7e3bd56b..0fd5bc63f3 100755
--- a/tools/run_tests/build_artifacts.py
+++ b/tools/run_tests/build_artifacts.py
@@ -45,7 +45,8 @@ import time
import uuid
# Docker doesn't clean up after itself, so we do it on exit.
-atexit.register(lambda: subprocess.call(['stty', 'echo']))
+if jobset.platform_string() == 'linux':
+ atexit.register(lambda: subprocess.call(['stty', 'echo']))
ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
os.chdir(ROOT)
@@ -122,7 +123,7 @@ class CSharpExtArtifact:
if self.platform == 'windows':
msbuild_platform = 'Win32' if self.arch == 'x86' else self.arch
return create_jobspec(self.name,
- ['vsprojects\\build_vs2013.bat',
+ ['tools\\run_tests\\build_artifact_csharp.bat',
'vsprojects\\grpc_csharp_ext.sln',
'/p:Configuration=Release',
'/p:PlatformToolset=v120',