diff options
author | Darin Petkov <petkov@chromium.org> | 2010-11-08 16:10:26 -0800 |
---|---|---|
committer | Darin Petkov <petkov@chromium.org> | 2010-11-08 16:10:26 -0800 |
commit | f67bb1f187d7fcea38a33badf4bc619fc2e5c0fc (patch) | |
tree | 3c491fa1388c9f5509867c15c4119079bb71743f | |
parent | 6d5dbf6458d55db480ebaa1b6fc3152631f722ad (diff) |
AU: Change test http server port from 8080 to 8088.
This allows developers to run unit tests while the dev server is running. Also
remove obsole test_http_server.py.
BUG=8889
TEST=unit tests while dev server is running.
Change-Id: Iaf0ff92edbb959d93bd206c0007455f637682e2c
Review URL: http://codereview.chromium.org/4667002
-rw-r--r-- | http_fetcher_unittest.cc | 4 | ||||
-rw-r--r-- | subprocess_unittest.cc | 2 | ||||
-rw-r--r-- | test_http_server.cc | 4 | ||||
-rwxr-xr-x | test_http_server.py | 55 |
4 files changed, 5 insertions, 60 deletions
diff --git a/http_fetcher_unittest.cc b/http_fetcher_unittest.cc index 6c420a0b..30cde956 100644 --- a/http_fetcher_unittest.cc +++ b/http_fetcher_unittest.cc @@ -24,8 +24,8 @@ using std::vector; namespace chromeos_update_engine { namespace { -// WARNING, if you update these, you must also update test_http_server.py -const char* const kServerPort = "8080"; +// WARNING, if you update these, you must also update test_http_server.cc. +const char* const kServerPort = "8088"; const int kBigSize = 100000; string LocalServerUrlForPath(const string& path) { return string("http://127.0.0.1:") + kServerPort + path; diff --git a/subprocess_unittest.cc b/subprocess_unittest.cc index 10dccbe5..679f85c1 100644 --- a/subprocess_unittest.cc +++ b/subprocess_unittest.cc @@ -25,7 +25,7 @@ class SubprocessTest : public ::testing::Test { }; namespace { -const int kLocalHttpPort = 8080; +const int kLocalHttpPort = 8088; void Callback(int return_code, void *p) { EXPECT_EQ(256, return_code); diff --git a/test_http_server.cc b/test_http_server.cc index de5c619c..6a919d5c 100644 --- a/test_http_server.cc +++ b/test_http_server.cc @@ -42,7 +42,7 @@ struct HttpRequest { }; namespace { -const int kPort = 8080; // hardcoded to 8080 for now +const int kPort = 8088; // hardcoded for now const int kBigLength = 100000; const int kMediumLength = 1000; } @@ -262,7 +262,7 @@ using namespace chromeos_update_engine; int main(int argc, char** argv) { // Ignore SIGPIPE on write() to sockets. signal(SIGPIPE, SIG_IGN); - + socklen_t clilen; struct sockaddr_in server_addr; struct sockaddr_in client_addr; diff --git a/test_http_server.py b/test_http_server.py deleted file mode 100755 index 404e0e06..00000000 --- a/test_http_server.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2009 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This is a simple HTTP server that's used by the -# libcurl_http_fetcher_unittest, though it could be used by others. In -# general, you can fork off this server, repeatedly request /test or -# some URL until that URL succeeds; then you know the server is -# running. The url /big returns 100,000 bytes of predictable data. The -# url /quitquitquit causes the server to exit. - -import SimpleHTTPServer, BaseHTTPServer, httplib - -class TestHttpRequestHandler (SimpleHTTPServer.SimpleHTTPRequestHandler): - def do_GET(self): - # Exit the server - if self.path == '/quitquitquit': - self.server.stop = True - - # Write 100,000 bytes out - if self.path == '/big': - self.send_response(200, 'OK') - self.send_header('Content-type', 'text/html') - self.end_headers() - for i in range(0, 10000): - try: - self.wfile.write('abcdefghij'); # 10 characters - except IOError: - return - return - - # Everything else - self.send_response(200, 'OK') - self.send_header('Content-type', 'text/html') - self.end_headers() - self.wfile.write('unhandled path') - -class TestHttpServer (BaseHTTPServer.HTTPServer): - def serve_forever(self): - self.stop = False - while not self.stop: - self.handle_request() - -def main(): - # TODO(adlr): Choose a port that works with build bots and report it to - # caller. - # WARNING, if you update this, you must also update http_fetcher_unittest.cc - port = 8080 - server = TestHttpServer(('', 8080), TestHttpRequestHandler) - server.serve_forever() - -if __name__ == '__main__': - main() |