STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_daq_interface.cpp File Reference
#include <sys/socket.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include "config/Config.hpp"
#include "net/DaqInterface.hpp"
Include dependency graph for test_daq_interface.cpp:

Go to the source code of this file.

Functions

static void check (bool ok, const std::string &what)
static fsw::config::Config makeConfig (const std::string &board_prefix, const std::string &bind_ip="")
 A config with two boards on the given subnet, and an optional explicit [network].bind_ip.
int main ()

Variables

static int g_failures = 0
 Which NIC board traffic leaves from.

Function Documentation

◆ check()

void check ( bool ok,
const std::string & what )
static

Definition at line 28 of file test_daq_interface.cpp.

References g_failures, and ok.

Referenced by main().

◆ main()

◆ makeConfig()

fsw::config::Config makeConfig ( const std::string & board_prefix,
const std::string & bind_ip = "" )
static

A config with two boards on the given subnet, and an optional explicit [network].bind_ip.

Definition at line 35 of file test_daq_interface.cpp.

References fsw::config::load_from_string().

Referenced by main().

Variable Documentation

◆ g_failures

int g_failures = 0
static

Which NIC board traffic leaves from.

The DAQ used to own its machine, so an unbound socket and "the board NIC" were the same thing. It now shares the apps box with the Docker stack and the site LAN, and resolveDaqBindAddress() is what re-establishes the guarantee. Every sender in the pipeline routes through it, so its four outcomes are pinned here rather than left to be discovered on a rig.

Addresses are chosen so the results do not depend on the machine running the test:

  • 127.0.0.x is loopback, present everywhere (this is also the shape the sim uses)
  • 192.0.2.x is TEST-NET-1 (RFC 5737), guaranteed not assigned to any interface
  • 198.51.100.x is TEST-NET-2, likewise — used for "no NIC on the board subnet"

The ambiguous case (two interfaces on the board subnet) is deliberately not tested: it cannot be produced without adding an address to the host, which a unit test has no business doing.

Definition at line 26 of file test_daq_interface.cpp.