From 9013ca536429173f7474c946c6db3027b3a036b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Fri, 7 Oct 2016 15:19:06 +0200 Subject: [PATCH] libports: remove old lwIP foc_panda tracing tests These tests were used for examine lwIP on foc_panda a few years back but serve no particular purpose as of now. Issue #2121. --- repos/libports/run/http_srv_tracing.run | 121 ---------- .../http_srv_tracing_nonblocking_panda.run | 80 ------- repos/libports/run/http_srv_tracing_panda.run | 85 ------- .../src/test/lwip/http_srv_tracing/main.cc | 147 ------------ .../src/test/lwip/http_srv_tracing/target.mk | 6 - .../lwip/http_srv_tracing_nonblocking/main.cc | 218 ------------------ .../http_srv_tracing_nonblocking/target.mk | 6 - 7 files changed, 663 deletions(-) delete mode 100644 repos/libports/run/http_srv_tracing.run delete mode 100644 repos/libports/run/http_srv_tracing_nonblocking_panda.run delete mode 100644 repos/libports/run/http_srv_tracing_panda.run delete mode 100644 repos/libports/src/test/lwip/http_srv_tracing/main.cc delete mode 100644 repos/libports/src/test/lwip/http_srv_tracing/target.mk delete mode 100644 repos/libports/src/test/lwip/http_srv_tracing_nonblocking/main.cc delete mode 100644 repos/libports/src/test/lwip/http_srv_tracing_nonblocking/target.mk diff --git a/repos/libports/run/http_srv_tracing.run b/repos/libports/run/http_srv_tracing.run deleted file mode 100644 index 12ace105cd..0000000000 --- a/repos/libports/run/http_srv_tracing.run +++ /dev/null @@ -1,121 +0,0 @@ -# -# \brief Test for using the lwIP TCP/IP stack -# \author Norman Feske -# \date 2011-05-22 -# -# This test case executes a small HTTP server on Genode running on qemu. When -# the HTTP server is up, a HTTP request to the server is performed using -# 'lynx'. The response is validated against a known pattern. -# -# The test uses qemu's "-net user" option, redirecting Genode's port 80 to the -# host's port 5555. Consequently, it cannot be executed on non-qemu test -# environments (i.e., the test won't work with the Linux version of Genode). -# -# Please make sure to include a nic driver in your build configuration. E.g., -# on the x86 platform, you may enable the 'dde_ipxe' repository. -# - -# -# TODO: Add support for Linux via user-level networking (using the -# tun/tap proxy driver at os/src/drivers/nic/linux) -# -if {[have_spec linux]} { - puts "Run script does not support Linux."; exit 0 } - -requires_installation_of lynx - -# -# Build -# - -set build_components { - core init - drivers/timer drivers/nic - test/lwip/http_srv_tracing -} - -source ${genode_dir}/repos/base/run/platform_drv.inc -append_platform_drv_build_components - -build $build_components - -create_boot_directory - -# -# Generate config -# - -set config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } - -append_platform_drv_config - -append config { - -} - -install_config $config - -# -# Boot modules -# - -# generic modules -set boot_modules { - core init timer - nic_drv - ld.lib.so libc.lib.so lwip.lib.so - test-lwip_httpsrv_tracing -} - -# platform-specific modules -append_platform_drv_boot_modules - -build_boot_image $boot_modules - -# -# Execute test case -# - -# qemu config -append qemu_args " -m 128 -nographic -serial mon:stdio " - -append_if [have_spec x86] qemu_args " -net nic,model=e1000 " -append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " - -append qemu_args " -net user -redir tcp:5555::80 " - -#run_genode_until {.*Sent response.*} 60 -run_genode_until forever - -# vi: set ft=tcl : diff --git a/repos/libports/run/http_srv_tracing_nonblocking_panda.run b/repos/libports/run/http_srv_tracing_nonblocking_panda.run deleted file mode 100644 index 56241fe8c9..0000000000 --- a/repos/libports/run/http_srv_tracing_nonblocking_panda.run +++ /dev/null @@ -1,80 +0,0 @@ -# vi: set ft=tcl : -assert_spec foc -assert_spec panda - -# -# Build -# -build { - core - init - drivers/timer - drivers/gpio - drivers/usb - test/lwip/http_srv_tracing_nonblocking -} - -create_boot_directory - -# -# Config -# -set config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -install_config $config - -# -# Boot modules -# -set boot_modules { - core - init - timer - usb_drv - gpio_drv - test-lwip_httpsrv_tracing_nob - ld.lib.so libc.lib.so lwip.lib.so -} - -build_boot_image [join $boot_modules " "] - diff --git a/repos/libports/run/http_srv_tracing_panda.run b/repos/libports/run/http_srv_tracing_panda.run deleted file mode 100644 index 1aa0d9ae0d..0000000000 --- a/repos/libports/run/http_srv_tracing_panda.run +++ /dev/null @@ -1,85 +0,0 @@ -# vi: set ft=tcl : -assert_spec foc -assert_spec panda - -# -# Build -# -build { - core - init - drivers/timer - drivers/usb - drivers/gpio - test/lwip/http_srv_tracing -} - -create_boot_directory - -# -# Config -# -set config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -install_config $config - -# -# Boot modules -# -set boot_modules { - core - init - timer - usb_drv - gpio_drv - test-lwip_httpsrv_tracing - ld.lib.so libc.lib.so lwip.lib.so -} - -build_boot_image [join $boot_modules " "] - diff --git a/repos/libports/src/test/lwip/http_srv_tracing/main.cc b/repos/libports/src/test/lwip/http_srv_tracing/main.cc deleted file mode 100644 index e14cb34040..0000000000 --- a/repos/libports/src/test/lwip/http_srv_tracing/main.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - * \brief Minimal HTTP server lwIP demonstration - * \author lwIP Team - * \author Stefan Kalkowski - * \date 2009-10-23 - * - * This small example shows how to use the LwIP in Genode directly. - * If you simply want to use LwIP's socket API, you might use - * Genode's libc together with its LwIP backend, especially useful - * when porting legacy code. - */ - -/* - * Copyright (C) 2009-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include - -/* LwIP includes */ -extern "C" { -#include -#include -} - -#include - -namespace Fiasco { -#include -} - - -//enum { FILE_SIZE = 1UL }; /* 1 Byte */ -enum { FILE_SIZE = 3072UL }; /* 3 KiB */ -//enum { FILE_SIZE = 5120UL }; /* 5 KiB */ -//enum { FILE_SIZE = 8388608UL }; /* 8 MiB */ -//enum { FILE_SIZE = 2097152UL }; /* 2 MiB */ -//enum { FILE_SIZE = 16777216UL }; /* 16 MiB */ -//enum { FILE_SIZE = 33554432UL }; /* 32 MiB */ - -const static char http_html_hdr[] = - "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"; /* HTTP response header */ - -static char http_file_data[FILE_SIZE]; - - -/** - * Handle a single client's request. - * - * \param conn socket connected to the client - */ -void http_server_serve(int conn) { - char buf[1024]; - ssize_t buflen; - - /* Read the data from the port, blocking if nothing yet there. - We assume the request (the part we care about) is in one packet */ - buflen = lwip_recv(conn, buf, 1024, 0); - - /* Ignore all receive errors */ - if (buflen > 0) { - - /* Is this an HTTP GET command? (only check the first 5 chars, since - there are other formats for GET, and we're keeping it very simple)*/ - if (buflen >= 5 && - buf[0] == 'G' && - buf[1] == 'E' && - buf[2] == 'T' && - buf[3] == ' ' && - buf[4] == '/' ) { - - /* Send http header */ - //Fiasco::fiasco_tbuf_log_3val(">> lwip_send", Genode::strlen(http_html_hdr), 0, 0); - lwip_send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0); - //Fiasco::fiasco_tbuf_log("<< lwip_send"); - - /* - unsigned int val = 0xdeadbeef; - Fiasco::fiasco_tbuf_log_3val(">> lwip_send", sizeof (unsigned int), 0, 0); - lwip_send(conn, &val, sizeof (unsigned int), 0); - Fiasco::fiasco_tbuf_log("<< lwip_send"); - */ - - lwip_send(conn, http_file_data, sizeof (http_file_data), 0); - } - } -} - -#include - -int main() -{ - enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 }; - - int s; - - lwip_tcpip_init(); - - /* Initialize network stack and do DHCP */ - if (lwip_nic_init(0, 0, 0, BUF_SIZE, BUF_SIZE)) { - Genode::error("got no IP address!"); - return -1; - } - - Genode::log("Create new socket ..."); - if((s = lwip_socket(AF_INET, SOCK_STREAM, 0)) < 0) { - Genode::error("no socket available!"); - return -1; - } - - Genode::log("Now, I will bind ..."); - struct sockaddr_in in_addr; - in_addr.sin_family = AF_INET; - in_addr.sin_port = htons(80); - in_addr.sin_addr.s_addr = INADDR_ANY; - if(lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) { - Genode::error("bind failed!"); - return -1; - } - - Genode::log("Now, I will listen ..."); - if(lwip_listen(s, 5)) { - Genode::error("listen failed!"); - return -1; - } - - Genode::log("Start the server loop ..."); - while(true) { - struct sockaddr addr; - socklen_t len = sizeof(addr); - int client = lwip_accept(s, &addr, &len); - if(client < 0) { - Genode::warning("invalid socket from accept!"); - continue; - } - http_server_serve(client); - lwip_close(client); - } - - return 0; -} diff --git a/repos/libports/src/test/lwip/http_srv_tracing/target.mk b/repos/libports/src/test/lwip/http_srv_tracing/target.mk deleted file mode 100644 index 8683c8f045..0000000000 --- a/repos/libports/src/test/lwip/http_srv_tracing/target.mk +++ /dev/null @@ -1,6 +0,0 @@ -TARGET = test-lwip_httpsrv_tracing -LIBS = lwip libc -SRC_CC = main.cc -REQUIRES = foc - -INC_DIR += $(REP_DIR)/src/lib/lwip/include diff --git a/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/main.cc b/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/main.cc deleted file mode 100644 index 35d36b8de3..0000000000 --- a/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/main.cc +++ /dev/null @@ -1,218 +0,0 @@ -/* - * \brief Minimal HTTP server lwIP demonstration - * \author lwIP Team - * \author Stefan Kalkowski - * \date 2009-10-23 - * - * This small example shows how to use the LwIP in Genode directly. - * If you simply want to use LwIP's socket API, you might use - * Genode's libc together with its LwIP backend, especially useful - * when porting legacy code. - */ - -/* - * Copyright (C) 2009-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -/* Genode includes */ -#include -#include -#include -#include - -/* LwIP includes */ -extern "C" { -#include -#include -} - -#include -#include - -//enum { FILE_SIZE = 8388608UL }; /* 8 MiB */ -//enum { FILE_SIZE = 2097152UL }; /* 2 MiB */ -//enum { FILE_SIZE = 16777216UL }; /* 16 MiB */ -//enum { FILE_SIZE = 33554432UL }; /* 32 MiB */ -enum { FILE_SIZE = 5120UL }; /* 5 KiB */ - -enum { MAX_CLIENTS = 1024 }; -enum { TRY_TO_CONNECT = 100 }; - -const static char http_html_hdr[] = - "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"; /* HTTP response header */ - -static char http_file_data[FILE_SIZE]; - -struct clients { - int fd; - struct sockaddr addr; - socklen_t len; -}; - -static struct clients c[MAX_CLIENTS]; - -/** - * Handle a single client's request. - * - * \param conn socket connected to the client - */ -void http_server_serve(int conn) { - char buf[1024]; - ssize_t buflen; - - /* Read the data from the port, blocking if nothing yet there. - We assume the request (the part we care about) is in one packet */ - buflen = lwip_recv(conn, buf, 1024, 0); - Genode::log("Packet received!"); - - /* Ignore all receive errors */ - if (buflen > 0) { - - /* Is this an HTTP GET command? (only check the first 5 chars, since - there are other formats for GET, and we're keeping it very simple)*/ - if (buflen >= 5 && - buf[0] == 'G' && - buf[1] == 'E' && - buf[2] == 'T' && - buf[3] == ' ' && - buf[4] == '/' ) { - - Genode::log("Will send response"); - - /* Send http header */ - lwip_send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0); - lwip_send(conn, http_file_data, FILE_SIZE, 0); - } - } -} - -#include - -int main() -{ - enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 }; - - int s, c_num; - - fd_set rs, ws, es; - - lwip_tcpip_init(); - - /* Initialize network stack and do DHCP */ - if (lwip_nic_init(0, 0, 0, BUF_SIZE, BUF_SIZE)) { - Genode::error("got no IP address!"); - return -1; - } - - Genode::log("Create new socket ..."); - if((s = lwip_socket(AF_INET, SOCK_STREAM, 0)) < 0) { - Genode::error("no socket available!"); - return -1; - } - - Genode::log("Now, I will bind to port 80 ..."); - struct sockaddr_in in_addr; - in_addr.sin_family = AF_INET; - in_addr.sin_port = htons(80); - in_addr.sin_addr.s_addr = INADDR_ANY; - memset(&(in_addr.sin_zero), '\0', 8); - - if (lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) { - Genode::error("bind failed!"); - return -1; - } - - Genode::log("Now, I will listen ..."); - if (lwip_listen(s, 5)) { - Genode::error("listen failed!"); - return -1; - } - - Genode::log("Make socket non-blocking ..."); - if (lwip_fcntl(s, F_SETFL, O_NONBLOCK)) { - Genode::error("fcntl() failed!"); - return -1; - } - - struct timeval timeout; - timeout.tv_sec = 1; - timeout.tv_usec = 0; - - for (int i = 0; i < MAX_CLIENTS; i++) - c[i].fd = -1; - - c_num = 0; - - Genode::log("Start the server loop ..."); - while(true) { - /* clear fds */ - FD_ZERO(&rs); - FD_ZERO(&ws); - FD_ZERO(&es); - - /* set fds */ - FD_SET(s, &rs); - for (int i = 0, num = c_num; i < MAX_CLIENTS; i++) { - if (c[i].fd != -1) { - FD_SET(c[i].fd, &rs); - - if (num > 0) - num--; - else - break; - } - } - - int ready = lwip_select(c_num + 1, &rs, &ws, &es, &timeout); - - if (ready > 0) { - if (FD_ISSET(s, &rs)) { - for (int i = 0; i < TRY_TO_CONNECT; i++) { - int *fd = &c[c_num].fd; - struct sockaddr *addr = &c[c_num].addr; - socklen_t *len = &c[c_num].len; - - *fd = lwip_accept(s, addr, len); - - if (*fd < 0) { - /* there is currently nobody waiting */ - if (errno == EWOULDBLOCK) - break; - - continue; - } - if (lwip_fcntl(*fd, F_SETFL, O_NONBLOCK)) { - lwip_close(*fd); - continue; - } - - c_num++; - } - } - - for (int i = 0, num = c_num; i < MAX_CLIENTS; i++) { - int *fd = &c[i].fd; - - if (*fd != -1) { - if (FD_ISSET(*fd, &rs)) { - http_server_serve(*fd); - lwip_close(*fd); - - c_num--; - *fd = -1; - } - - if (num > 0) - num--; - else - break; - } - } - } - } - - return 0; -} diff --git a/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/target.mk b/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/target.mk deleted file mode 100644 index 08893fc208..0000000000 --- a/repos/libports/src/test/lwip/http_srv_tracing_nonblocking/target.mk +++ /dev/null @@ -1,6 +0,0 @@ -TARGET = test-lwip_httpsrv_tracing_nob -LIBS = lwip libc -SRC_CC = main.cc -REQUIRES = foc - -INC_DIR += $(REP_DIR)/src/lib/lwip/include