This is an automated email from the ASF dual-hosted git repository.

dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 91748d4771 Cleanup - remove a few unused files. (#12061)
91748d4771 is described below

commit 91748d47712482fe39dbdfc5c29d46fc65f7d3ae
Author: Damian Meden <[email protected]>
AuthorDate: Tue Mar 4 10:09:26 2025 +0100

    Cleanup - remove a few unused files. (#12061)
    
    * Cleanup - remove a few unused files.
    
    They aren't built and also contains some compilation errors spotted by
    my local cppcheck run.
---
 src/proxy/http/TestUrl.cc           | 114 -------
 src/proxy/http/test_socket_close.cc | 628 ------------------------------------
 src/proxy/http/testheaders.cc       | 133 --------
 src/records/test_I_RecLocal.cc      | 207 ------------
 src/records/test_I_RecProcess.cc    |  25 --
 src/records/test_P_RecProcess.cc    |  25 --
 src/records/test_RecProcess.i       | 608 ----------------------------------
 7 files changed, 1740 deletions(-)

diff --git a/src/proxy/http/TestUrl.cc b/src/proxy/http/TestUrl.cc
deleted file mode 100644
index ed1ef2beb0..0000000000
--- a/src/proxy/http/TestUrl.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "proxy/hdrs/URL.h"
-#include <iostream.h>
-#include <fstream.h>
-
-URL *
-create_url(const char *url_string)
-{
-  char buf[4096];
-  int  len   = 0;
-  URL *url_p = new URL(url_string);
-  URL &url   = *url_p;
-
-  cout << "scheme        : " << url.getScheme() << endl;
-  len      = url.getUserName(buf, sizeof(buf));
-  buf[len] = '\0';
-  cout << "user name     : " << buf << endl;
-  cout << "UserNameExists: " << url.userNameExists() << endl;
-  cout << "UserNameEmpty : " << url.userNameEmpty() << endl;
-
-  len      = url.getPassword(buf, sizeof(buf));
-  buf[len] = '\0';
-  cout << "password      : " << buf << endl;
-  cout << "PasswordExists: " << url.passwordExists() << endl;
-  cout << "PasswordEmpty : " << url.passwordEmpty() << endl;
-
-  len      = url.getHost(buf, sizeof(buf));
-  buf[len] = '\0';
-  cout << "host          : " << buf << endl;
-  cout << "HostEmpty     : " << url.hostEmpty() << endl;
-
-  cout << "port          : " << url.getPort() << endl;
-  cout << "PortEmpty     : " << url.portEmpty() << endl;
-  cout << "DefaultPort   : " << url.defaultPort() << endl;
-
-  // get specifics for this scheme
-  switch (url.getScheme()) {
-  case URL_SCHEME_NONE:
-  case URL_SCHEME_HTTP:
-  case URL_SCHEME_HTTPS:
-    len      = url.getHttpPath(buf, sizeof(buf));
-    buf[len] = '\0';
-    cout << "http path     : " << buf << endl;
-    len      = url.getParams(buf, sizeof(buf));
-    buf[len] = '\0';
-    cout << "http params   : " << buf << endl;
-    len      = url.getQuery(buf, sizeof(buf));
-    buf[len] = '\0';
-    cout << "http query    : " << buf << endl;
-    len      = url.getFragment(buf, sizeof(buf));
-    buf[len] = '\0';
-    cout << "http fragment : " << buf << endl;
-    break;
-
-  default:
-    break;
-  }
-  cout << "real length   : " << strlen(url_string) << endl;
-  cout << "u-bound length: " << url.getUrlLengthUpperBound() << endl;
-  cout << endl;
-
-  int bl = url.dump(buf, sizeof(buf) - 1);
-  cout << buf << endl << endl;
-  cout << "bytes = " << bl << endl;
-
-  return (url_p);
-}
-
-void
-test_marshal(URL *url)
-{
-  char buf[8196];
-
-  int bl = url->marshal(buf, sizeof(buf) - 1);
-  cout << buf << endl << endl;
-  cout << "bytes = " << bl << endl;
-
-  // test unmarshal
-  URL new_url;
-  new_url.unmarshal(buf, bl);
-
-  int bl2 = new_url.marshal(buf, sizeof(buf) - 1);
-  cout << buf << endl << endl;
-  cout << "bytes = " << bl << endl;
-
-  return;
-}
-
-main()
-{
-  
create_url("www.microsoft.com/isapi/redir.dll?TARGET=%2Foffice%2Fmigration%2F&nonie3home&homepage&&&&headline1&1006");
-}
diff --git a/src/proxy/http/test_socket_close.cc 
b/src/proxy/http/test_socket_close.cc
deleted file mode 100644
index ac5f16bacc..0000000000
--- a/src/proxy/http/test_socket_close.cc
+++ /dev/null
@@ -1,628 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include <iostream.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/filio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "/usr/include/netdb.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fstream.h>
-#include <strstream.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-enum Task_t {
-  TASK_NONE = 0,
-  TASK_DONE,
-  TASK_CONNECT,
-  TASK_LISTEN_SETUP,
-  TASK_ACCEPT,
-  TASK_SHUTDOWN_OUTPUT,
-  TASK_SHUTDOWN_INPUT,
-  TASK_SHUTDOWN_BOTH,
-  TASK_TRY_READ,
-  TASK_TRY_WRITE,
-  TASK_TRY_WRITE_THEN_SHUTDOWN_OUTPUT,
-  TASK_TRY_WRITE_THEN_SHUTDOWN_BOTH,
-  TASK_COUNT
-};
-
-enum State_t {
-  STATE_IDLE = 0,
-  STATE_DONE,
-  STATE_ERROR,
-};
-
-enum Connection_t {
-  CONNECTION_CLIENT,
-  CONNECTION_SERVER,
-};
-
-enum Scenario_t {
-  SERVER_WRITE_CLIENT_READ,
-
-  SERVER_SHUTDOWN_OUTPUT_CLIENT_TRY_READ,
-  SERVER_SHUTDOWN_INPUT_CLIENT_TRY_READ,
-  SERVER_SHUTDOWN_BOTH_CLIENT_TRY_READ,
-  SERVER_SHUTDOWN_OUTPUT_CLIENT_TRY_WRITE,
-  SERVER_SHUTDOWN_INPUT_CLIENT_TRY_WRITE,
-  SERVER_SHUTDOWN_BOTH_CLIENT_TRY_WRITE,
-
-  CLIENT_SHUTDOWN_OUTPUT_SERVER_TRY_READ,
-  CLIENT_SHUTDOWN_INPUT_SERVER_TRY_READ,
-  CLIENT_SHUTDOWN_BOTH_SERVER_TRY_READ,
-  CLIENT_SHUTDOWN_OUTPUT_SERVER_TRY_WRITE,
-  CLIENT_SHUTDOWN_INPUT_SERVER_TRY_WRITE,
-  CLIENT_SHUTDOWN_BOTH_SERVER_TRY_WRITE,
-
-  SERVER_WRITE_IMMIDIATE_SHUTDOWN_CLIENT_WRITE
-};
-
-struct State {
-  State_t state;
-  int     tasks_count;
-  Task_t  tasks[100];
-  int64_t nbytes_write; // number of bytes to write
-  intte_t nbytes_read;  // number of bytes to read
-
-  State() : state(STATE_IDLE), tasks_count(0), nbytes_write(0), {}
-};
-
-struct Conn {
-  Connection_t       connection_type;
-  int                listen_s;
-  int                s;
-  struct sockaddr_in addr;
-  State              state;
-  // State_t            state;
-  int state_delay_ms;
-};
-
-Conn   client, server;
-int    port_number;
-Task_t server_set_next_client_task[TASK_COUNT];
-Task_t client_set_next_server_task[TASK_COUNT];
-char   write_buf[10];
-char   read_buf[10];
-int    state_delay_ms = 0;
-
-#define IS_DONE(c) (c.state.state == STATE_DONE || c.state.state == 
STATE_ERROR)
-
-void main_loop();
-void state_act(Conn *c);
-void state_act_task(Conn *c);
-int  do_connect(Conn *from, Conn *to);
-int  do_listen_setup(Conn *c, int port_number);
-int  do_accept(Conn *c);
-int  create_nonblocking_socket();
-int  set_nonblocking_socket(int s);
-int  do_shutdown(int s, Task_t task);
-int  do_try_read(int s, char *buf, int length);
-int  do_try_write(int s, char *buf, int length);
-void setup_scenario(Scenario_t scenario);
-void dequeue_task(Conn *c);
-///////////////////////////////////////////////////////////
-//
-//  main()
-//
-///////////////////////////////////////////////////////////
-int
-main(int argc, char **argv)
-{
-  if (argc < 2) {
-    cout << "test_socket_close <port number> <state delay ms>" << endl;
-    return (0);
-  }
-  port_number = atoi(argv[1]);
-
-  if (argc >= 3) {
-    state_delay_ms = atoi(argv[2]);
-  }
-
-  memset(&client, '\0', sizeof(client));
-  memset(&server, '\0', sizeof(server));
-
-  memset(&write_buf, 'B', sizeof(write_buf));
-  memset(&read_buf, '\0', sizeof(read_buf));
-
-  client.connection_type = CONNECTION_CLIENT;
-  server.connection_type = CONNECTION_SERVER;
-
-  client.state.state = STATE_IDLE;
-  server.state.state = STATE_IDLE;
-
-  client.state.tasks_count = 0;
-  server.state.tasks_count = 1;
-  server.state.tasks[0]    = TASK_LISTEN_SETUP;
-
-  client.state_delay_ms = state_delay_ms;
-  server.state_delay_ms = state_delay_ms;
-
-  ////////////////////
-  // set next state //
-  ////////////////////
-  setup_scenario(SERVER_WRITE_IMMIDIATE_SHUTDOWN_CLIENT_WRITE);
-  // setup_scenario(SERVER_WRITE_CLIENT_READ);
-
-  main_loop();
-
-  return (0);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  main_loop()
-//
-///////////////////////////////////////////////////////////
-void
-main_loop()
-{
-  while (!IS_DONE(client) || !IS_DONE(server)) {
-    if (client.state.tasks_count > 0 && !IS_DONE(client)) {
-      state_act(&client);
-    }
-    if (server.state.tasks_count > 0 && !IS_DONE(server)) {
-      state_act(&server);
-    }
-  }
-  return;
-}
-
-///////////////////////////////////////////////////////////
-//
-//  state_act()
-//
-///////////////////////////////////////////////////////////
-void
-state_act(Conn *c)
-{
-  Task_t saved_task = c->state.tasks[0];
-
-  Conn &cr = *c;
-
-  while (c->state.tasks_count > 0 && !IS_DONE(cr)) {
-    if (c->state_delay_ms) {
-      poll(0, 0, c->state_delay_ms);
-    }
-    state_act_task(c);
-  }
-
-  if (IS_DONE(cr)) {
-    cr.state.tasks_count = 1;
-    cr.state.tasks[0]    = TASK_DONE;
-  }
-
-  if ((c == &client && IS_DONE(server)) || (c == &server && IS_DONE(client))) {
-    cr.state.tasks_count = 1;
-    cr.state.tasks[0]    = saved_task;
-  } else if (c == &client) {
-    server.state.tasks_count = 1;
-    server.state.tasks[0]    = client_set_next_server_task[saved_task];
-  } else {
-    client.state.tasks_count = 1;
-    client.state.tasks[0]    = server_set_next_client_task[saved_task];
-  }
-  return;
-}
-
-///////////////////////////////////////////////////////////
-//
-//  state_act_task()
-//
-///////////////////////////////////////////////////////////
-void
-state_act_task(Conn *c)
-{
-  char write_ch = 'T', read_ch;
-  int  r;
-
-  Task_t saved_task = c->state.tasks[0];
-
-  switch (c->state.tasks[0]) {
-  case TASK_CONNECT:
-    assert(c == &client);
-    do_connect(&client, &server);
-    dequeue_task(&client);
-    break;
-
-  case TASK_SHUTDOWN_OUTPUT:
-  case TASK_SHUTDOWN_INPUT:
-  case TASK_SHUTDOWN_BOTH:
-    if (do_shutdown(c->s, c->state.tasks[0]) < 0)
-      c->state.state = STATE_ERROR;
-    else
-      c->state.state = STATE_DONE;
-
-    dequeue_task(c);
-    break;
-
-  case TASK_TRY_READ:
-    r = do_try_read(c->s, &read_ch, 1);
-    if (r > 0)
-      c->state.state = STATE_IDLE;
-    else if (r == 0)
-      c->state.state = STATE_DONE; // EOS
-    else if (r != -EAGAIN)
-      c->state.state = STATE_ERROR; // error
-    dequeue_task(c);
-    break;
-
-  case TASK_TRY_WRITE:
-    r = do_try_write(c->s, &write_ch, 1);
-    if (r <= 0 && r != -EAGAIN)
-      c->state.state = STATE_ERROR; // error
-    else
-      c->state.state = STATE_IDLE;
-    dequeue_task(c);
-    break;
-
-  case TASK_TRY_WRITE_THEN_SHUTDOWN_OUTPUT:
-  case TASK_TRY_WRITE_THEN_SHUTDOWN_BOTH:
-    r = do_try_write(c->s, write_buf, c->state.nbytes_write);
-    if (r <= 0 && r != -EAGAIN)
-      c->state.state = STATE_ERROR; // error
-    else {
-      c->state.nbytes_write -= r;
-      if (c->state.nbytes_write == 0) {
-        // do shutdown
-        if (do_shutdown(c->s, c->state.tasks[0]) < 0)
-          c->state.state = STATE_ERROR;
-        else
-          c->state.state = STATE_DONE;
-
-        dequeue_task(c);
-      }
-    }
-    break;
-
-  case TASK_LISTEN_SETUP:
-    assert(c == &server);
-    if (do_listen_setup(&server, port_number) > 0) {
-      dequeue_task(&server);
-    }
-    break;
-
-  case TASK_ACCEPT:
-    assert(c == &server);
-    if (do_accept(&server) > 0) {
-      dequeue_task(&server);
-    }
-    break;
-  }
-
-  return;
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_connect()
-//
-//  'to' must be listening
-///////////////////////////////////////////////////////////
-int
-do_connect(Conn *from, Conn *to)
-{
-  assert(to->listen_s > 0);
-
-  // create a non-blocking socket
-  if ((from->s = create_nonblocking_socket()) < 0) {
-    from->state.state = STATE_ERROR;
-    return (from->s);
-  }
-  // connect
-  if (connect(from->s, (struct sockaddr *)&to->addr, sizeof(to->addr)) < 0) {
-    int error = -errno;
-    if (error != -EINPROGRESS) {
-      ::close(from->s);
-      from->state.state = STATE_ERROR;
-      cout << "connect failed (" << error << ")" << endl;
-      return (error);
-    }
-  }
-  // success
-  cout << "connect is done" << endl;
-  from->state.state = STATE_IDLE;
-  return (from->s);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_listen_setup()
-//
-///////////////////////////////////////////////////////////
-int
-do_listen_setup(Conn *c, int port)
-{
-  int error;
-
-  c->addr.sin_family = AF_INET;
-  memset(&c->addr.sin_zero, 0, 8);
-  c->addr.sin_addr.s_addr = htonl(INADDR_ANY);
-  c->addr.sin_port        = htons(port);
-
-  // create a non-blocking socket
-  if ((c->listen_s = create_nonblocking_socket()) < 0) {
-    c->state.state = STATE_ERROR;
-    return (c->listen_s);
-  }
-  // bind socket to port
-  if (bind(c->listen_s, (struct sockaddr *)&c->addr, sizeof(c->addr)) < 0) {
-    error = -errno;
-    ::close(c->listen_s);
-    c->state.state = STATE_ERROR;
-    cout << "bind failed (" << error << ")" << endl;
-    return (error);
-  }
-  // listen
-  if (listen(c->listen_s, 5) < 0) {
-    error = -errno;
-    ::close(c->listen_s);
-    c->state.state = STATE_ERROR;
-    cout << "listen failed (" << error << ")" << endl;
-    return (-1);
-  }
-  // success
-  cout << "listen is done" << endl;
-  c->state.state = STATE_IDLE;
-
-  return (c->listen_s);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_accept()
-//
-///////////////////////////////////////////////////////////
-int
-do_accept(Conn *c)
-{
-  assert(c->listen_s > 0);
-
-  // check if socket is ready for read
-  fd_set         readfds;
-  struct timeval timeout;
-  int            addrlen;
-
-  FD_ZERO(&readfds);
-  FD_SET(c->listen_s, &readfds);
-  timeout.tv_sec  = 0;
-  timeout.tv_usec = 10; /* 0.01 ms */
-
-  if (select(c->listen_s + 1, &readfds, 0, 0, &timeout) > 0) {
-    addrlen = sizeof(c->addr);
-    c->s    = accept(c->listen_s, (struct sockaddr *)&c->addr, &addrlen);
-    if (c->s < 0) {
-      c->s = -errno;
-      cout << "accept failed (" << c->s << ")" << endl;
-      c->state.state = STATE_ERROR;
-      return (c->s);
-    }
-    if ((c->s = set_nonblocking_socket(c->s)) < 0) {
-      c->state.state = STATE_ERROR;
-      return (c->s);
-    }
-    c->state.state = STATE_IDLE;
-  }
-  cout << "accept is done" << endl;
-  return (c->s);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  create_nonblocking_socket()
-//
-///////////////////////////////////////////////////////////
-int
-create_nonblocking_socket()
-{
-  int s;
-
-  if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-    s = -errno;
-    cout << "socket failed (" << s << ")" << endl;
-    return (s);
-  }
-  return (set_nonblocking_socket(s));
-}
-
-///////////////////////////////////////////////////////////
-//
-//  set_nonblocking_socket()
-//
-///////////////////////////////////////////////////////////
-int
-set_nonblocking_socket(int s)
-{
-  if (fcntl(s, F_SETFL, O_NDELAY) < 0) {
-    int error = -errno;
-    ::close(s);
-    cout << "fcntl F_SETFD O_NDELAY failed (" << error << ")" << endl;
-    return (error);
-  }
-
-  return (s);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_shutdown()
-//
-///////////////////////////////////////////////////////////
-int
-do_shutdown(int s, Task_t task)
-{
-  int howto;
-
-  switch (task) {
-  case TASK_SHUTDOWN_OUTPUT:
-  case TASK_TRY_WRITE_THEN_SHUTDOWN_OUTPUT:
-    howto = 1;
-    break;
-  case TASK_SHUTDOWN_INPUT:
-    howto = 0;
-    break;
-  case TASK_SHUTDOWN_BOTH:
-  case TASK_TRY_WRITE_THEN_SHUTDOWN_BOTH:
-    howto = 2;
-    break;
-  default:
-    assert(!"expected a shutdown state");
-    break;
-  }
-  if (shutdown(s, howto) < 0) {
-    int error = -errno;
-    cout << "shutdown failed (" << error << ")" << endl;
-    return (error);
-  }
-  // success
-  cout << "sutdowm is done" << endl;
-  return (0);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_try_read()
-//
-///////////////////////////////////////////////////////////
-int
-do_try_read(int s, char *buf, int length)
-{
-  int r;
-
-  if ((r = read(s, buf, length)) < 0) {
-    r = -errno;
-    if (r != -EWOULDBLOCK) // EWOULDBLOCK == EAGAIN
-    {
-      cout << "read failed (" << r << ")" << endl;
-    }
-  } else if (r == 0) {
-    cout << "connection closed" << endl;
-  } else {
-    // read is successful
-    for (int i = 0; i < r; i++) {
-      cout << buf[i] << ' ';
-    }
-  }
-  return (r);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  do_try_write()
-//
-///////////////////////////////////////////////////////////
-int
-do_try_write(int s, char *buf, int length)
-{
-  int r;
-
-  if ((r = write(s, buf, length)) <= 0) {
-    r = -errno;
-    if (r != -EWOULDBLOCK) {
-      cout << "write failed (" << r << ")" << endl;
-    }
-  }
-  return (r);
-}
-
-///////////////////////////////////////////////////////////
-//
-//  setup_scenario()
-//
-///////////////////////////////////////////////////////////
-void
-setup_scenario(Scenario_t scenario)
-{
-  switch (scenario) {
-  case SERVER_WRITE_CLIENT_READ:
-    server_set_next_client_task[TASK_LISTEN_SETUP] = TASK_CONNECT;
-    client_set_next_server_task[TASK_CONNECT]      = TASK_ACCEPT;
-    server_set_next_client_task[TASK_ACCEPT]       = TASK_TRY_READ;
-    client_set_next_server_task[TASK_TRY_READ]     = TASK_TRY_WRITE;
-    server_set_next_client_task[TASK_TRY_WRITE]    = TASK_TRY_READ;
-    break;
-
-  case SERVER_SHUTDOWN_OUTPUT_CLIENT_TRY_READ:
-    server_set_next_client_task[TASK_LISTEN_SETUP]    = TASK_CONNECT;
-    server_set_next_client_task[TASK_ACCEPT]          = TASK_TRY_READ;
-    server_set_next_client_task[TASK_SHUTDOWN_OUTPUT] = TASK_TRY_READ;
-
-    client_set_next_server_task[TASK_CONNECT]  = TASK_ACCEPT;
-    client_set_next_server_task[TASK_TRY_READ] = TASK_SHUTDOWN_OUTPUT;
-    break;
-
-  case SERVER_SHUTDOWN_INPUT_CLIENT_TRY_READ:
-    break;
-  case SERVER_SHUTDOWN_BOTH_CLIENT_TRY_READ:
-    break;
-  case SERVER_SHUTDOWN_OUTPUT_CLIENT_TRY_WRITE:
-    break;
-  case SERVER_SHUTDOWN_INPUT_CLIENT_TRY_WRITE:
-    break;
-  case SERVER_SHUTDOWN_BOTH_CLIENT_TRY_WRITE:
-    break;
-  case CLIENT_SHUTDOWN_OUTPUT_SERVER_TRY_READ:
-    break;
-  case CLIENT_SHUTDOWN_INPUT_SERVER_TRY_READ:
-    break;
-  case CLIENT_SHUTDOWN_BOTH_SERVER_TRY_READ:
-    break;
-  case CLIENT_SHUTDOWN_OUTPUT_SERVER_TRY_WRITE:
-    break;
-  case CLIENT_SHUTDOWN_INPUT_SERVER_TRY_WRITE:
-    break;
-  case CLIENT_SHUTDOWN_BOTH_SERVER_TRY_WRITE:
-    break;
-  case SERVER_WRITE_IMMIDIATE_SHUTDOWN_CLIENT_WRITE:
-    server_set_next_client_task[TASK_LISTEN_SETUP]                 = 
TASK_CONNECT;
-    client_set_next_server_task[TASK_CONNECT]                      = 
TASK_ACCEPT;
-    server_set_next_client_task[TASK_ACCEPT]                       = 
TASK_TRY_READ;
-    client_set_next_server_task[TASK_TRY_READ]                     = 
TASK_TRY_WRITE_THEN_SHUTDOWN_BOTH;
-    server_set_next_client_task[TASK_TRY_WRITE_THEN_SHUTDOWN_BOTH] = 
TASK_TRY_READ;
-    server_set_next_client_task[TASK_DONE]                         = 
TASK_TRY_READ;
-    server.state.nbytes_write                                      = 
sizeof(write_buf);
-    break;
-  }
-  return;
-}
-
-void
-dequeue_task(Conn *c)
-{
-  if (c->state.tasks_count == 0)
-    return;
-
-  c->state.tasks_count--;
-  for (int i = 0; i < c->state.tasks_count; i++) {
-    c->state.tasks[i] = c->state.tasks[i + 1];
-  }
-  return;
-}
diff --git a/src/proxy/http/testheaders.cc b/src/proxy/http/testheaders.cc
deleted file mode 100644
index e7ba52f35c..0000000000
--- a/src/proxy/http/testheaders.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "tscore/ink_string.h"
-#include "proxy/http/HttpTransact.h"
-#include "proxy/http/HttpTransactHeaders.h"
-
-#define MAX_FIELD_VALUE_SIZE 512
-
-char request1[] = "GET http://people.netscape.com/jwz/hacks-1.gif HTTP/1.0\r\n"
-                  "If-Modified-Since: Wednesday, 26-Feb-97 06:58:17 GMT; 
length=842\r\n"
-                  "Referer: http://people.netscape.com/jwz/index.html\r\n";
-                  "Proxy-Connection: Referer, User-Agent\r\n"
-                  "Vary: If-Modified-Since, Host, Accept, Proxy-Connection, 
Crap\r\n"
-                  "User-Agent:  Mozilla/3.01 (X11; I; Linux 2.0.28 i586)\r\n"
-                  "Crappy-Field: value1-on-line-1, value2-on-line-1\r\n"
-                  "Crappy-Field: value-on-line-2\r\n"
-                  "Blowme: Crapshoot\r\n"
-                  "Pragma: no-cache\r\n"
-                  "Host: people.netscape.com\r\n"
-                  "Accept: image/gif, image/x-xbitmap, image/jpeg, 
image/pjpeg, */*\r\n\r\n";
-
-char response1[] = "HTTP/1.0 200 !132d63600000000000000200 OK\r\n"
-                   "Server: WN/1.14.6\r\n"
-                   "Date: Tue, 26 Aug 1997 21:51:23 GMT\r\n"
-                   "Last-modified: Fri, 25 Jul 1997 15:07:05 GMT\r\n"
-                   "Content-type: text/html\r\n"
-                   "Content-length: 3831\r\n"
-                   "Accept-Range: bytes, lines\r\n"
-                   "Title: General Casualty - Home Page\r\n";
-
-char response2[] = "HTTP/1.0 304 Not Modified\r\n"
-                   "Date: Wed, 30 Jul 1997 22:31:20 GMT\r\n"
-                   "Via: 1.0 trafficserver.apache.org (Traffic-Server/1.0b 
[ONM])\r\n"
-                   "Server: Apache/1.1.1\r\n\r\n";
-
-void print_header(HttpHeader *header);
-
-void
-readin_header(HttpHeader *new_header, char *req_buffer, int length)
-{
-  int bytes_used = 0;
-
-  const char *tmp = req_buffer;
-  while (*tmp) {
-    if (new_header->parse(tmp, length, &bytes_used, false, 
HTTP_MESSAGE_TYPE_REQUEST) != 0)
-      break;
-    tmp += length;
-  }
-}
-
-// void print_header(HttpHeader *header)
-// {
-//     bool done = false;
-//     int bytes_used = 0;
-//     char dumpbuf;
-
-//     header->dump_setup ();
-//     while (!done) {
-//      header->dump (&dumpbuf, 1, &bytes_used, &done);
-//      putc (dumpbuf, stdout);
-//     }
-// }
-
-inline void
-make_comma_separated_header_field_value(HttpHeader *header, const char 
*fieldname, char *full_str)
-{
-  MIMEHeaderFieldValue *hfv;
-  const char           *str;
-
-  hfv = header->mime().get(fieldname, strlen(fieldname));
-
-  /* This if is needed to put in the commas correctly */
-  if (hfv) {
-    str = hfv->get_raw();
-    ink_strlcat(full_str, str, MAX_FIELD_VALUE_SIZE);
-    hfv = hfv->next();
-  }
-  while (hfv) {
-    str = hfv->get_raw();
-    ink_strlcat(full_str, ", ", MAX_FIELD_VALUE_SIZE);
-    ink_strlcat(full_str, str, MAX_FIELD_VALUE_SIZE);
-    hfv = hfv->next();
-  }
-}
-
-void
-test_headers()
-{
-  HttpHeader *req;
-  char        str1[MAX_FIELD_VALUE_SIZE];
-  char        str2[MAX_FIELD_VALUE_SIZE];
-  char        str3[MAX_FIELD_VALUE_SIZE];
-
-  req = new (HttpHeaderAllocator.alloc()) HttpHeader();
-
-  readin_header(req, request1, sizeof(request1));
-  printf("[test_headers] This is the header that was read in:\n");
-  print_header(req);
-
-  printf("[test_headers] Ok, let us see what the Proxy-Connection field is 
...\n");
-  printf("[test_headers] the value of Blowme is %s\n", 
req->mime().get_raw("Blowme", strlen("Blowme")));
-  //     make_comma_separated_header_field_value(req, "Proxy-Connection", 
str1);
-  //     printf("[test_headers] Proxy-Connection is %s\n", str1);
-
-  //     printf("[test_headers] Let us try that with crappy-field...\n");
-  //     make_comma_separated_header_field_value(req, "Crappy-Field", str2);
-  //     printf("[test_headers] Crappy-Field is : %s\n", str2);
-
-  //     printf("[test_headers] Let us try that with Vary, now...\n");
-  //     make_comma_separated_header_field_value(req, "Vary", str3);
-  //     printf("[test_headers] Vary is %s\n", str3);
-}
diff --git a/src/records/test_I_RecLocal.cc b/src/records/test_I_RecLocal.cc
deleted file mode 100644
index 11cfbab278..0000000000
--- a/src/records/test_I_RecLocal.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "P_RecUtils.h"
-#include "test_RecordsConfig.h"
-
-#include "P_RecCore.h"
-
-void
-DiagsPtr::set(Diags *new_ptr)
-{
-  _diags_ptr = new_ptr;
-}
-
-void RecDumpRecordsHt(RecT rec_type);
-
-//-------------------------------------------------------------------------
-// Test01: Callback Test
-//
-// The following test verifies that the callbacks are executed.
-//-------------------------------------------------------------------------
-int g_config_update_result = 0;
-
-int
-cb_test_1a(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  if ((cookie == (void *)0x12345678) && (strcmp(data.rec_string, 
"cb_test_1__changed") == 0)) {
-    g_config_update_result++;
-    printf("    - cb_test_1(%d) name: %s, data: %s, cookie: 0x%x\n", 
g_config_update_result, name, data.rec_string, cookie);
-  } else {
-    g_config_update_result = 0;
-  }
-  return REC_ERR_OKAY;
-}
-
-int
-cb_test_1b(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  return cb_test_1a(name, data_type, data, cookie);
-}
-
-int
-cb_test_2a(const char * /* name ATS_UNUSED */, RecDataT /* data_type 
ATS_UNUSED */, RecData /* data ATS_UNUSED */,
-           void * /* cookie ATS_UNUSED */)
-{
-  g_config_update_result = -1;
-  return REC_ERR_FAIL;
-}
-
-int
-cb_test_2b(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  return cb_test_2a(name, data_type, data, cookie);
-}
-
-void
-Test01()
-{
-  g_config_update_result = 0;
-  printf("\n[Test01: Callback Tests]\n");
-
-  printf("  [RecRegisterConfigUpdateCb]\n");
-
-  // Initialize variables
-  RecSetRecordString("proxy.config.local.cb_test_1", "cb_test_1__original");
-  RecSetRecordString("proxy.config.local.cb_test_2", "cb_test_2__original");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Register config update callbacks
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1a, (void 
*)0x12345678);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_1", cb_test_1b, (void 
*)0x12345678);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2a, (void 
*)0x87654321);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_2", cb_test_2b, (void 
*)0x87654321);
-
-  // Change proxy.config.cb_test_1
-  RecSetRecordString("proxy.config.local.cb_test_1", "cb_test_1__changed");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Check globals to make sure the right thing happened
-  if (g_config_update_result == 2) {
-    printf("    SUMMARY: PASS (%d)\n", g_config_update_result);
-  } else {
-    printf("    SUMMARY: FAIL (%d)\n", g_config_update_result);
-  }
-}
-
-//-------------------------------------------------------------------------
-// Test02: Callback (Multi-lock) Test
-//
-// The following test verifies we can access the variables within its own
-// callbacks. When a callback is invoked, the record's mutex lock has
-// already taken. If RecMutex works properly, we can still access the
-// variable within its own callback.
-//-------------------------------------------------------------------------
-int
-cb_test_3a(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  RecString rec_result;
-  int       rec_status = RecGetRecordString_Xmalloc(name, &rec_result);
-
-  if ((rec_status == REC_ERR_OKAY) && (cookie == (void *)0x12344321) && 
(strcmp(rec_result, "cb_test_3__changed") == 0)) {
-    ink_assert(strcmp(rec_result, data.rec_string) == 0);
-
-    g_config_update_result++;
-    printf("    - cb_test_3(%d) name: %s, data: %s, cookie: 0x%x\n", 
g_config_update_result, name, rec_result, cookie);
-  } else {
-    g_config_update_result = 0;
-  }
-  return REC_ERR_OKAY;
-}
-
-int
-cb_test_3b(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  return cb_test_3a(name, data_type, data, cookie);
-}
-
-void
-Test02()
-{
-  g_config_update_result = 0;
-  printf("\n[Test02: Callback (Multi-lock) Test]\n");
-
-  printf("  [RecRegisterConfigUpdateCb]\n");
-
-  // Initialize variables
-  RecSetRecordString("proxy.config.local.cb_test_3", "cb_test_3__original");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Register config update callbacks
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3a, (void 
*)0x12344321);
-  RecRegisterConfigUpdateCb("proxy.config.local.cb_test_3", cb_test_3b, (void 
*)0x12344321);
-
-  // Change proxy.config.cb_test_1
-  RecSetRecordString("proxy.config.local.cb_test_3", "cb_test_3__changed");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Check globals to make sure the right thing happened
-  if (g_config_update_result == 2) {
-    printf("    SUMMARY: PASS (%d)\n", g_config_update_result);
-  } else {
-    printf("    SUMMARY: FAIL (%d)\n", g_config_update_result);
-  }
-}
-
-//-------------------------------------------------------------------------
-// main
-//-------------------------------------------------------------------------
-
-int
-main(int argc, char **argv)
-{
-  // start diags logging
-  FILE *log_fp;
-  if ((log_fp = fopen("reclocal.log", "a+")) != nullptr) {
-    int status = setvbuf(log_fp, nullptr, _IOLBF, 512);
-    if (status != 0) {
-      fclose(log_fp);
-      log_fp = nullptr;
-    }
-  }
-  DiagsPtr::set(new Diags("rec", nullptr, log_fp));
-  diags()->activate_taglist(diags()->base_debug_tags, DiagsTagType_Debug);
-  diags()->log(nullptr, DTA(DL_Note), "Starting '%s'", argv[0]);
-
-  // system initialization
-  RecLocalInit(diags());
-  RecLocalInitMessage();
-  RecordsConfigRegister();
-  RecLocalStart();
-
-  // test
-  Test01(); // Local callbacks
-  Test02(); // Local callbacks -- multi-lock
-  Test03(); // RecTree
-
-  while (true) {
-    RecDumpRecordsHt(RECT_NULL);
-    sleep(10);
-  }
-
-  return 0;
-}
diff --git a/src/records/test_I_RecProcess.cc b/src/records/test_I_RecProcess.cc
deleted file mode 100644
index 071720073e..0000000000
--- a/src/records/test_I_RecProcess.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "records/RecProcess.h"
-#include "test_RecProcess.i"
diff --git a/src/records/test_P_RecProcess.cc b/src/records/test_P_RecProcess.cc
deleted file mode 100644
index b8d65dba31..0000000000
--- a/src/records/test_P_RecProcess.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "P_RecProcess.h"
-#include "test_RecProcess.i"
diff --git a/src/records/test_RecProcess.i b/src/records/test_RecProcess.i
deleted file mode 100644
index 98acbfbc54..0000000000
--- a/src/records/test_RecProcess.i
+++ /dev/null
@@ -1,608 +0,0 @@
-/** @file
-
-  A small test and sample program for librecords_p.a
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "ts/ink_hrtime.h"
-#include "P_RecUtils.h"
-#include "test_RecordsConfig.h"
-
-Diags *diags = NULL;
-
-void RecDumpRecordsHt(RecT rec_type);
-
-//-------------------------------------------------------------------------
-// Test01: Parse Tests
-//
-// The following test just verifies that we can parse the
-// 'records.config' file format correctly (e.g can we handle weird
-// spacing, malformed lines, etc).  The test also verifies some of the
-// basic RecGetRecord functionality.
-//
-// Run this test with the 'test_records.config' config file.  Note
-// that the configs used by this test are registered in the
-// 'test_RecordsConfig.cc' file.
-//-------------------------------------------------------------------------
-
-#define PARSE_TEST_UNAVAILABLE(name, failures) \
-  do { \
-    RecString rec_string = 0; \
-    if (RecGetRecordString_Xmalloc("proxy.config.parse_"name, &rec_string) != 
REC_ERR_FAIL) { \
-      ats_free(rec_string); \
-      printf("  parse_"name": FAIL\n"); \
-      failures++; \
-    } else { \
-      printf("  parse_"name": PASS\n"); \
-    } \
-  } while (0);
-
-#define PARSE_TEST_COMPARE(name, value, failures) \
-  do { \
-    RecString rec_string = 0; \
-    if (RecGetRecordString_Xmalloc("proxy.config.parse_"name, &rec_string) == 
REC_ERR_OKAY) { \
-      if (strcmp(rec_string, value) == 0) { \
-       printf("  parse_"name": PASS\n"); \
-      } else { \
-       printf("  parse_"name": FAIL\n"); \
-       failures++; \
-      } \
-      ats_free(rec_string); \
-    } else { \
-      printf("  parse_"name": FAIL\n"); \
-      failures++; \
-    } \
-  } while (0);
-
-void
-Test01()
-{
-  printf("[Test01: Parse Tests]\n");
-  int failures = 0;
-
-  // test 1 and 1b
-  PARSE_TEST_UNAVAILABLE("test_1a", failures);
-  PARSE_TEST_UNAVAILABLE("test_1b", failures);
-
-  // test 2, 2b, 3, 3b, 4, 4b
-  PARSE_TEST_COMPARE("test_2a", "X", failures);
-  PARSE_TEST_COMPARE("test_2b", "X", failures);
-  PARSE_TEST_COMPARE("test_3b", "XXX", failures);
-  PARSE_TEST_COMPARE("test_3b", "XXX", failures);
-  PARSE_TEST_COMPARE("test_4a", "XXX XXX XXX", failures);
-  PARSE_TEST_COMPARE("test_4b", "XXX XXX XXX", failures);
-
-  if (failures == 0) {
-    printf("  SUMMARY: PASS\n");
-  } else {
-    printf("  SUMMARY: FAIL\n");
-  }
-  return;
-}
-
-//-------------------------------------------------------------------------
-// Test02: Config Tests
-//
-// The following test stresses some additional config features
-// (e.g. registration of config update callbacks, config linking, and
-// config setting).  As with Test01, config registration must be done
-// in 'test_RecordsConfig.cc'.
-//-------------------------------------------------------------------------
-
-bool g_config_update_result = false;
-
-RecInt g_link_test_1 = 0;
-RecFloat g_link_test_2 = 0.0f;
-RecCounter g_link_test_3 = 0;
-
-int
-cb_test_1(const char *name, RecDataT data_type, RecData data, void *cookie)
-{
-  if ((cookie == (void *) 0x12345678) && (strcmp(data.rec_string, 
"cb_test_1__changed") == 0)) {
-    printf("    - cb_test_1 (name: %s, data: %s, cookie: 0x%x\n", name, 
data.rec_string, cookie);
-    g_config_update_result = true;
-  } else {
-    g_config_update_result = false;
-  }
-  return REC_ERR_OKAY;
-}
-
-int
-cb_test_2(const char */* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED 
*/,
-          RecData /* data ATS_UNUSED */, void * /* cookie ATS_UNUSED */)
-{
-  g_config_update_result = false;
-  return REC_ERR_FAIL;
-}
-
-void
-Test02()
-{
-  printf("[Test02: Config Tests]\n");
-  int failures = 0;
-
-  printf("  [RecRegisterConfigUpdateCb]\n");
-
-  // Initialize variables
-  RecSetRecordString("proxy.config.cb_test_1", "cb_test_1__original");
-  RecSetRecordString("proxy.config.cb_test_2", "cb_test_2__original");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  ink_sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Register config update callbacks
-  RecRegisterConfigUpdateCb("proxy.config.cb_test_1", cb_test_1, (void *) 
0x12345678);
-  RecRegisterConfigUpdateCb("proxy.config.cb_test_2", cb_test_2, (void *) 
0x87654321);
-
-  // Change proxy.config.cb_test_1
-  RecSetRecordString("proxy.config.cb_test_1", "cb_test_1__changed");
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  ink_sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Check globals to make sure the right thing happened
-  if (g_config_update_result == true) {
-    printf("    SUMMARY: PASS\n");
-  } else {
-    printf("    SUMMARY: FAIL\n");
-  }
-
-  printf("  [RecLinkConfigXXX]\n");
-
-  // Set configs
-  RecSetRecordInt("proxy.config.link_test_1", 1);
-  RecSetRecordFloat("proxy.config.link_test_2", 100.0f);
-  RecSetRecordCounter("proxy.config.link_test_3", 5);
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  ink_sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  // Link configs
-  RecLinkConfigInt("proxy.config.link_test_1", &g_link_test_1);
-  RecLinkConfigFloat("proxy.config.link_test_2", &g_link_test_2);
-  RecLinkConfigCounter("proxy.config.link_test_3", &g_link_test_3);
-
-  // Initial check to make sure link worked
-  printf("    - g_link_test_1 = %d:%d, expect: 1\n", g_link_test_1);
-  printf("    - g_link_test_2 = %f, expect: %f\n", g_link_test_2, 100.0f);
-  printf("    - g_link_test_3 = %d:%d, expect: 5\n", g_link_test_3);
-  if (g_link_test_1 == 1 && g_link_test_2 == 100.0f && g_link_test_3 == 5) {
-    printf("    SUMMARY: PASS\n");
-  } else {
-    printf("    SUMMARY: FAIL\n");
-  }
-
-  printf("  [RecGetRecordXXX]\n");
-
-  RecString rec_string = 0;
-  const int buf_len = 1024;
-  char buf[buf_len];
-
-  RecGetRecordString_Xmalloc("proxy.config.cb_test_2", &rec_string);
-  if (!rec_string || (rec_string && strcmp(rec_string, "cb_test_2__original")) 
!= 0) {
-    printf("    RecGetRecordString_Xmalloc: FAIL (expected: 
'cb_test_2__original', got: '%s')\n",
-           rec_string ? rec_string : "<nothing>");
-  } else {
-    printf("    RecGetRecordString_Xmalloc: PASS (%s)\n", rec_string);
-  }
-
-  RecGetRecordString("proxy.config.cb_test_2", buf, buf_len);
-  if (strcmp(buf, "cb_test_2__original") != 0) {
-    printf("    RecGetRecordString:         FAIL (expected: 
'cb_test_2__original', got: '%s')\n", buf);
-  } else {
-    printf("    RecGetRecordString:         PASS (%s)\n", buf);
-  }
-
-  // Testing with RecGetRecordInt, RecGetRecordFloat and RecGetRecordCounter
-  RecInt rec_int = 0;
-  RecGetRecordInt("proxy.config.link_test_1", &rec_int);
-  if (rec_int != 1) {
-    printf("    RecGetRecordInt:            FAIL (expected: 1, got %d:%d)\n", 
rec_int);
-  } else {
-    printf("    RecGetRecordInt:            PASS (%d:%d)\n", rec_int);
-  }
-
-  RecFloat rec_float = 0;
-  RecGetRecordFloat("proxy.config.link_test_2", &rec_float);
-  if (rec_float != 100.0f) {
-    printf("    RecGetRecordFloat:          FAIL (expected: %f, got %f)\n", 
100.0f, rec_float);
-  } else {
-    printf("    RecGetRecordFloat:          PASS (%f)\n", rec_float);
-  }
-
-  RecCounter rec_counter = 0;
-  RecGetRecordCounter("proxy.config.link_test_3", &rec_counter);
-  if (rec_counter != 5) {
-    printf("    RecGetRecordCounter:        FAIL (expected: 5, got %d:%d)\n", 
rec_counter);
-  } else {
-    printf("    RecGetRecordCounter:        PASS (%d:%d)\n", rec_counter);
-  }
-
-  // Testing RecLinkConfigXXX, after calling RecLinkConfigXXX above, those
-  // variable will automatically be atomically updated when record changes in
-  // librecords.
-  printf("  [RecLinkConfigXXX]\n");
-
-  // Set the records
-  printf("    - RecSetRecordXXX\n");
-  RecSetRecordString("proxy.config.cb_test_1", "cb_test_1_changed");
-  RecSetRecordInt("proxy.config.link_test_1", 2);
-  RecSetRecordFloat("proxy.config.link_test_2", 200.0f);
-  RecSetRecordCounter("proxy.config.link_test_3", 6);
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  ink_sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-  printf("    - g_link_test_1 = %d:%d, expect: 2\n", g_link_test_1);
-  printf("    - g_link_test_2 = %f, expect: %f\n", g_link_test_2, 200.0f);
-  printf("    - g_link_test_3 = %d:%d, expect: 6\n", g_link_test_3);
-  if (g_link_test_1 == 2 && g_link_test_2 == 200.0f && g_link_test_3 == 6) {
-    printf("    SUMMARY: PASS\n");
-  } else {
-    printf("    SUMMARY: FAIL\n");
-  }
-
-  RecSetRecordInt("proxy.config.link_test_1", 1);
-  RecSetRecordFloat("proxy.config.link_test_2", 100.0f);
-  RecSetRecordCounter("proxy.config.link_test_3", 5);
-  printf("    - sleep(2*REC_CONFIG_UPDATE_INTERVAL_SEC)\n");
-  ink_sleep(2 * REC_CONFIG_UPDATE_INTERVAL_SEC);
-
-}
-
-//-------------------------------------------------------------------------
-// Test03: RawStat Tests
-//
-// The following test illustrates how one might use the RawStat
-// interface to librecprocess.a.  It also illustrates a custom RawStat
-// sync function, 'raw_stat_sync_ticks_per_sec' that computes
-// operations per second (used by AIO module).
-//-------------------------------------------------------------------------
-
-enum my_stat_enum
-{
-  MY_STAT_A,
-  MY_STAT_B,
-  MY_STAT_C,
-  MY_STAT_D,
-  MY_STAT_E,
-  MY_STAT_F,
-  MY_STAT_G,
-  MY_STAT_COUNT
-};
-
-static RecRawStatBlock *g_rsb = NULL;
-static int g_count = 0;
-
-static int g_ticks = 0;
-static int g_time = 0;
-
-int
-raw_stat_sync_ticks_per_sec(const char *name, RecDataT data_type, RecData * 
data, RecRawStatBlock * rsb, int id)
-{
-  ink64 ticks_old, time_old;
-  ink64 ticks_new, time_new;
-
-  RecRawStat *rrs = RecGetGlobalRawStatPtr(rsb, id);
-  ink64 *rrs_sum = RecGetGlobalRawStatSumPtr(rsb, id);
-  ink64 *rrs_count = RecGetGlobalRawStatCountPtr(rsb, id);
-
-  RecGetGlobalRawStatSum(rsb, id, &ticks_old);
-  RecGetGlobalRawStatCount(rsb, id, &time_old);
-
-  if ((rrs->sum != ticks_old) && (*rrs_sum != ticks_old)) {
-    printf("ERROR: (rrs->sum != ticks_old) && (*rrs_sum != ticks_old)\n");
-  }
-  /*else {
-     printf("OKAY: GlobalRawStatSum == RecRawStat->sum == && GlobalRawStatSum 
== GlobalRawStatSumPtr, which is %d:%d\n", ticks_old);
-     } */
-  if ((rrs->count != time_old) && (*rrs_count != time_old)) {
-    printf("ERROR: (rrs->count != time_old) && (*rrs_sum != ticks_old)\n");
-  }
-  /*else {
-     printf("OKAY: GlobalRawStatCount == RecRawStat->count && 
GlobalRawStatCount == GlobalRawStatCountPtr, which is %d:%d\n", time_old);
-     } */
-  ticks_new = g_ticks;
-  time_new = g_time;
-
-  data->rec_float = (float) (ticks_new - ticks_old) / (float) (time_new - 
time_old);
-
-  RecSetGlobalRawStatSum(rsb, id, ticks_new);
-  RecSetGlobalRawStatCount(rsb, id, time_new);
-
-  return REC_ERR_OKAY;
-
-}
-
-struct RawStatCont:public Continuation
-{
-  RawStatCont(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&RawStatCont::dummy_function);
-  }
-  int dummy_function(int event, Event * e)
-  {
-    printf("------------Raw Stat dump-------------\n");
-    ink64 hr_start, hr_finish;
-    // comments out here. Why stat_a is int?
-    RecInt stat_b, stat_c, stat_f, stat_g;
-    RecFloat stat_a, stat_d, stat_e;
-    // comments out here
-
-    hr_start = ink_get_hrtime();
-
-    // test_raw_stat_a should have around 16000 in it (avg of rand())
-    RecIncrRawStat(g_rsb, mutex->thread_holding, (int) MY_STAT_A, rand());
-
-    // test_raw_stat_b should have g_count plustorial in it
-    RecIncrRawStatSum(g_rsb, mutex->thread_holding, (int) MY_STAT_B, g_count);
-
-    // test_raw_stat_c should have g_count plustorial in it
-    //RecSetRawStatCount(g_rsb, (int) MY_STAT_C, g_count);
-    RecIncrRawStatCount(g_rsb, mutex->thread_holding, (int) MY_STAT_C, 
g_count);
-
-    // test_raw_stat_f should have g_count in it
-    // I have switched this with test_raw_stat_c
-    RecSetRawStatCount(g_rsb, (int) MY_STAT_F, g_count);
-
-    // test_raw_stat_g should have g_count in it
-    RecSetRawStatSum(g_rsb, (int) MY_STAT_G, g_count);
-
-    // test_raw_stat_d should have 4 it (e.g. we're run 4 times a second)
-    ink_atomic_increment(&g_ticks, 1);
-    g_time = time(0);
-
-    // sleep for a bit to take some time
-    struct timespec rgtp;
-    rgtp.tv_sec = 0;
-    rgtp.tv_nsec = 10000;
-    nanosleep(&rgtp, NULL);
-
-    // FIXME: Read values and compare against expected values rather
-    // than just printing out
-
-    // comments out here
-    RecGetRecordFloat("proxy.process.test_raw_stat_a", &stat_a);
-    RecGetRecordInt("proxy.process.test_raw_stat_b", &stat_b);
-    RecGetRecordInt("proxy.process.test_raw_stat_c", &stat_c);
-    RecGetRecordFloat("proxy.process.test_raw_stat_d", &stat_d);
-    RecGetRecordFloat("proxy.process.test_raw_stat_e", &stat_e);
-    RecGetRecordInt("proxy.process.test_raw_stat_f", &stat_f);
-    RecGetRecordInt("proxy.process.test_raw_stat_g", &stat_g);
-
-    /*
-       printf("-> g_count: %d, thr: 0x%x, stat_a: %d%d, stat_b: %d:%d, stat_c: 
%d:%d, stat_d: %f\n",
-       g_count, mutex->thread_holding, stat_a, stat_b, stat_c, stat_d);
-
-       printf("-> g_link_test_1: %d:%d, g_link_test_2: %f\n",
-       g_link_test_1, g_link_test_2);
-     */
-
-    // Compare read value stat_a and expected value test_raw_stat_a
-    RecRawStat test_raw_stat_a;
-    RecFloat avg = 0.0f;
-    test_raw_stat_a.sum = REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_A]->sum));
-    test_raw_stat_a.count = 
REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_A]->count));
-    if (test_raw_stat_a.count != 0)
-      avg = (float) ((double) test_raw_stat_a.sum / (double) 
test_raw_stat_a.count);
-
-    if (stat_a != avg) {
-      printf("ERROR: stat_a: %f, expect stat_a: %f\n", stat_a, avg);
-    } else {
-      printf("OKAY: stat_a: %f, expect stat_a: %f\n", stat_a, avg);
-    }
-
-    // Compare read value stat_b and expected value test_raw_stat_b
-    RecRawStat test_raw_stat_b;
-    test_raw_stat_b.sum = REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_B]->sum));
-    if (stat_b != test_raw_stat_b.sum) {
-      printf("ERROR: After RecIncrRawStatSum, stat_b: %d:%d, expect stat_b: 
%d:%d\n", stat_b, test_raw_stat_b.sum);
-    } else {
-      printf("OKAY: After RecIncrRawStatSum, stat_b: %d:%d, expect stat_b: 
%d:%d\n", stat_b, test_raw_stat_b.sum);
-    }
-
-    // Compare read value stat_c and expected value test_raw_stat_c
-    RecRawStat test_raw_stat_c;
-    test_raw_stat_c.count = 
REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_C]->count));
-    if (stat_c != test_raw_stat_c.count) {
-      printf("ERROR: After RecIncrRawStatCount, stat_c: %d:%d, expect stat_c: 
%d:%d\n", stat_c, test_raw_stat_c.count);
-    } else {
-      printf("OKAY: After RecIncrRawStatCount, stat_c: %d:%d, expect stat_c: 
%d:%d\n", stat_c, test_raw_stat_c.count);
-    }
-
-    // Compare read value stat_d and expected value test_raw_stat_d
-    ink64 ticks_old, time_old;
-    RecGetGlobalRawStatSum(g_rsb, MY_STAT_D, &ticks_old);
-    RecGetGlobalRawStatCount(g_rsb, MY_STAT_D, &time_old);
-    RecFloat data = (float) (g_ticks - ticks_old) / (float) (g_time - 
time_old);
-    if (stat_d != 4.0f) {
-      printf("ERROR: stat_d: %f, expect stat_d: %f or I got data: %f\n", 
stat_d, 4.0f, data);
-    } else {
-      printf("OKAY: stat_d: %f, expect stat_d: %f or I got data: %f\n", 
stat_d, 4.0f, data);
-    }
-
-    // Compare read value stat_e and expected value test_raw_stat_e
-    RecRawStat test_raw_stat_e;
-    RecFloat r;
-    test_raw_stat_e.sum = REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_E]->sum));
-    test_raw_stat_e.count = 
REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_E]->count));
-    if (test_raw_stat_e.count == 0) {
-      r = 0.0f;
-    } else {
-      r = (float) ((double) test_raw_stat_e.sum / (double) 
test_raw_stat_e.count);
-      r = r / (float) (HRTIME_SECOND);
-    }
-    if (stat_e != r) {
-      printf("ERROR: stat_e: %f, expect stat_e from avg: %f\n", stat_e, r);
-    } else {
-      printf("OKAY: stat_e: %f, expect stat_e from avg: %f\n", stat_e, r);
-    }
-
-    // Compare read value stat_f and expected value test_raw_stat_f
-    // Since RecSet only set g_rsb->global[MY_STAT_F]->count to be g_count 
value.
-    // It will not set data.rec_int for stat_f until the RecExecRawStatSyncCbs
-    // is called. RecExecRawStatSyncCbs callback RecRawStatSyncCount which set
-    // data.rec_int to be g_rsb->global[MY_STAT_F]->count. The schedule for
-    // RecExecRawStatSyncCbs is REC_RAW_STAT_SYNC_INTERVAL_SEC = 3 secs.
-    // The normal for this dummy_function is 1 sec. There is no way we can
-    // get the right value for this. Let ask Eric for this :)
-    // I have increase the ink_sleep time (about 3 secs) between RecSet and 
RecGet
-    // for stat_c hoping that we got the RecExecRawStatSyncCbs at the middle 
of them
-    // so we can get the right value for stat_c. However, this will screw up
-    // stat_d badly as we get NaN for stat_d.
-    RecRawStat test_raw_stat_f;
-    test_raw_stat_f.count = 
REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_F]->count));
-    RecInt check_stat_f;
-    RecGetRawStatCount(g_rsb, (int) MY_STAT_F, &check_stat_f);
-    if (stat_f != test_raw_stat_f.count || stat_f != check_stat_f) {
-      printf("ERROR: After RecSetRawStatCount, stat_f: %d:%d, stat_f by 
REC_ATOMIC_READ64: %d:%d\n", stat_f,
-             test_raw_stat_f.count);
-      printf("       stat_f by RecGetRawStatCount: %d:%d\n", check_stat_f);
-    } else {
-      printf("OKAY: After RecSetRawStatCount, stat_f: %d:%d, stat_f by 
REC_ATOMIC_READ64: %d:%d\n", stat_f,
-             test_raw_stat_f.count);
-      printf("      stat_f by RecGetRawStatCount: %d:%d\n", check_stat_f);
-    }
-
-    // Compare read value stat_g and expected value test_raw_stat_g
-    RecRawStat test_raw_stat_g;
-    test_raw_stat_g.sum = REC_ATOMIC_READ64(&(g_rsb->global[MY_STAT_G]->sum));
-    RecInt check_stat_g;
-    RecGetRawStatSum(g_rsb, (int) MY_STAT_G, &check_stat_g);
-    if (stat_g != test_raw_stat_g.count || stat_g != check_stat_g) {
-      printf("ERROR: After RecSetRawStatSum, stat_g: %d:%d, stat_g by 
REC_ATOMIC_READ64: %d:%d\n", stat_g,
-             test_raw_stat_g.sum);
-      printf("       stat_g by RecGetRawStatSum: %d:%d\n", check_stat_g);
-    } else {
-      printf("OKAY: After RecSetRawStatSum, stat_g: %d:%d, stat_g by 
REC_ATOMIC_READ64: %d:%d\n", stat_g,
-             test_raw_stat_g.sum);
-      printf("      stat_g by RecGetRawStatSum: %d:%d\n", check_stat_g);
-    }
-    ink_atomic_increment(&g_count, 1);
-
-    // test_raw_stat_e should have the time it takes to run this function
-    hr_finish = ink_get_hrtime();
-    RecIncrRawStat(g_rsb, mutex->thread_holding, (int) MY_STAT_E, hr_finish - 
hr_start);
-
-    return 0;
-  }
-};
-
-void
-Test03()
-{
-  printf("[Test03: RawStat Test]\n");
-
-  // Register raw statistics
-  g_rsb = RecAllocateRawStatBlock((int) MY_STAT_COUNT);
-
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_a",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) MY_STAT_A, 
RecRawStatSyncAvg);
-
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_b",
-                     RECD_INT, RECP_PERSISTENT, (int) MY_STAT_B, 
RecRawStatSyncSum);
-
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_c",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) MY_STAT_C, 
RecRawStatSyncCount);
-
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_d",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) MY_STAT_D, 
raw_stat_sync_ticks_per_sec);
-
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_e",
-                     RECD_FLOAT, RECP_NON_PERSISTENT, (int) MY_STAT_E, 
RecRawStatSyncHrTimeAvg);
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_f",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) MY_STAT_F, 
RecRawStatSyncCount);
-  // If forget to Register this RawStat, we will have SEGV when checking
-  // g_rsb->global[MY_STAT_G]
-  RecRegisterRawStat(g_rsb, RECT_PROCESS, "proxy.process.test_raw_stat_g",
-                     RECD_INT, RECP_NON_PERSISTENT, (int) MY_STAT_G, 
RecRawStatSyncSum);
-
-  // Schedule a bunch of continuations that will use the stats registered above
-  RawStatCont *sc = new RawStatCont(new_ProxyMutex());
-  eventProcessor.schedule_every(sc, HRTIME_SECONDS(1), ET_CALL, 
EVENT_INTERVAL, NULL);
-  eventProcessor.schedule_every(sc, HRTIME_SECONDS(1), ET_CALL, 
EVENT_INTERVAL, NULL);
-  eventProcessor.schedule_every(sc, HRTIME_SECONDS(1), ET_CALL, 
EVENT_INTERVAL, NULL);
-  eventProcessor.schedule_every(sc, HRTIME_SECONDS(1), ET_CALL, 
EVENT_INTERVAL, NULL);
-
-}
-
-//-------------------------------------------------------------------------
-// DumpRecordHtCont
-//-------------------------------------------------------------------------
-
-struct DumpRecordsHtCont:public Continuation
-{
-  DumpRecordsHtCont(ProxyMutex * m):Continuation(m)
-  {
-    SET_HANDLER(&DumpRecordsHtCont::dummy_function);
-  }
-  int dummy_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
-  {
-    RecDumpRecordsHt(RECT_NULL);
-    return 0;
-  }
-};
-
-//-------------------------------------------------------------------------
-// main
-//-------------------------------------------------------------------------
-
-int
-main(int argc, char **argv)
-{
-
-  // Start diags logging
-  FILE *log_fp;
-  if ((log_fp = fopen("recprocess.log", "a+")) != NULL) {
-    int status = setvbuf(log_fp, NULL, _IOLBF, 512);
-    if (status != 0) {
-      fclose(log_fp);
-      log_fp = NULL;
-    }
-  }
-  diags = new Diags("rec", NULL, log_fp);
-  diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
-  diags->print(NULL, DL_Note, NULL, NULL, "Starting '%s'", argv[0]);
-
-  // System initialization.  Note that a pointer to the diags object
-  // is passed into librecprocess.a.  If manager isn't running, we
-  // need to register our own configs
-  RecProcessInit( diags);
-  RecProcessInitMessage();
-    RecordsConfigRegister();
-  ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(4);
-  RecProcessStart();
-
-  // See if we're sync'd okay
-  RecDumpRecordsHt(RECT_NULL);
-
-
-  // Run tests
-  TreeTest01();
-  Test01();
-  Test02();
-  Test03();
-  TreeTest02();
-
-
-  // Schedule dump continuation so that we can see what's going on
-  DumpRecordsHtCont *drhc = new DumpRecordsHtCont(new_ProxyMutex());
-  eventProcessor.schedule_every(drhc, HRTIME_SECONDS(10), ET_CALL, 
EVENT_INTERVAL, NULL);
-
-  this_thread()->execute();
-  return 0;
-}

Reply via email to