STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_script_runtime.cpp File Reference
#include <unistd.h>
#include <chrono>
#include <cstdio>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <string>
#include <thread>
#include "BoardListener.hpp"
#include "control/SequencerService.hpp"
#include "control/StateMachine.hpp"
Include dependency graph for test_script_runtime.cpp:

Go to the source code of this file.

Enumerations

enum class  State
 System state IDs — must match the TypeScript SystemState enum in web-gui/shared/types.ts. More...

Functions

static void check (bool ok, const std::string &what)
template<typename F>
static std::string captureStdout (F &&body)
 Channel 1 = Vent Valve (column always CLOSE — only a script opens it), 2 = Main Valve.
static std::string writeConfig (const std::string &script, uint32_t timeout_ms, const std::string &return_target, const std::string &timeout_target)
static long long waitForState (SequencerService &svc, State want, int timeout_ms)
int main ()
long long firstCommand (const std::vector< Burst > &bursts, uint8_t ch, uint8_t hw, long long after_ms=-1)
 When ch was first commanded to hw at or after after_ms.

Variables

static int g_failures = 0
static fs::path g_dir
static constexpr uint16_t kActPort = 45919
static constexpr uint16_t kAbortPort = 15007

Enumeration Type Documentation

◆ State

enum class sequencer::State : uint8_t
strong

System state IDs — must match the TypeScript SystemState enum in web-gui/shared/types.ts.

Definition at line 14 of file StateMachine.hpp.

Function Documentation

◆ captureStdout()

template<typename F>
std::string captureStdout ( F && body)
static

Channel 1 = Vent Valve (column always CLOSE — only a script opens it), 2 = Main Valve.

Run body with stdout redirected to a file, and give back what it printed.

The diagnostics these tests pin are log lines and nothing else — they exist so an operator can tell a loop that never ran from one that ran and timed out, which are the two outcomes that looked identical on the stand. Asserting on the text is the only way to keep them honest.

Definition at line 64 of file test_script_runtime.cpp.

References g_dir.

Referenced by main().

◆ check()

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

Definition at line 44 of file test_script_runtime.cpp.

References g_failures, and ok.

Referenced by main().

◆ firstCommand()

long long daqtest::firstCommand ( const std::vector< Burst > & bursts,
uint8_t ch,
uint8_t hw,
long long after_ms = -1 )
inline

When ch was first commanded to hw at or after after_ms.

-1 if it never was.

Definition at line 133 of file BoardListener.hpp.

Referenced by main().

◆ main()

◆ waitForState()

long long waitForState ( SequencerService & svc,
State want,
int timeout_ms )
static

Definition at line 140 of file test_script_runtime.cpp.

References sequencer::SequencerService::currentState().

Referenced by main().

◆ writeConfig()

std::string writeConfig ( const std::string & script,
uint32_t timeout_ms,
const std::string & return_target,
const std::string & timeout_target )
static

Definition at line 78 of file test_script_runtime.cpp.

References a, g_dir, kAbortPort, kActPort, and fs::path::string().

Referenced by main().

Variable Documentation

◆ g_dir

fs::path g_dir
static

Definition at line 50 of file test_script_runtime.cpp.

◆ g_failures

int g_failures = 0
static

Definition at line 42 of file test_script_runtime.cpp.

◆ kAbortPort

uint16_t kAbortPort = 15007
staticconstexpr

Definition at line 52 of file test_script_runtime.cpp.

◆ kActPort

uint16_t kActPort = 45919
staticconstexpr

Definition at line 51 of file test_script_runtime.cpp.

Referenced by attemptEntry(), main(), writeConfig(), and writeConfig().