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
diff --git a/http_fetcher_unittest.cc b/http_fetcher_unittest.cc
index 6c420a0..30cde95 100644
--- a/http_fetcher_unittest.cc
+++ b/http_fetcher_unittest.cc
@@ -24,8 +24,8 @@
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 10dccbe..679f85c 100644
--- a/subprocess_unittest.cc
+++ b/subprocess_unittest.cc
@@ -25,7 +25,7 @@
};
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 de5c619..6a919d5 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -42,7 +42,7 @@
};
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 @@
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 404e0e0..0000000
--- 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()