Skip to content

Commit f6fd67a

Browse files
committed
tests: increase shared memory size
1 parent b69097b commit f6fd67a

File tree

6 files changed

+90
-78
lines changed

6 files changed

+90
-78
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,68 +2,68 @@ name: PANOSETI gRPC CI
22

33
on:
44
push:
5-
branches: [ tests ]
5+
branches: [ main, tests ]
66
pull_request:
7-
branches: [ tests ]
7+
branches: [ main ]
88

99
jobs:
10-
# daq-data-build-and-test:
11-
# runs-on: ubuntu-latest
12-
# steps:
13-
# # Checks-out repository
14-
# - name: Checkout repository
15-
# uses: actions/checkout@v3
16-
#
17-
# # Set up Docker Buildx
18-
# # enables advanced features like multi-platform builds and cache management.
19-
# - name: Set up Docker Buildx
20-
# uses: docker/setup-buildx-action@v3
21-
#
22-
# #Build the Docker image with cache enabled
23-
# # This step builds the image and pushes the cache to the GitHub Actions cache.
24-
# # The 'load: true' flag makes the image available to subsequent steps in the same job.
25-
# - name: Build and cache Docker image
26-
# uses: docker/build-push-action@v5
27-
# with:
28-
# context: .
29-
# file: ./tests/daq_data/Dockerfile
30-
# load: true # Makes the image available for the next step
31-
# tags: panoseti-grpc-test-daq-data:latest
32-
# cache-from: type=gha # Pulls cache from GitHub Actions cache
33-
# cache-to: type=gha,mode=max # Pushes cache to GitHub Actions cache
34-
#
35-
# # Run tests inside the now-cached Docker container
36-
# - name: Run Pytest in container
37-
# run: docker run --rm panoseti-grpc-test-daq-data:latest
38-
#
39-
# ublox-control-build-and-test:
40-
# runs-on: ubuntu-latest
41-
# steps:
42-
# # Checks-out repository
43-
# - name: Checkout repository
44-
# uses: actions/checkout@v3
45-
#
46-
# # Set up Docker Buildx
47-
# # enables advanced features like multi-platform builds and cache management.
48-
# - name: Set up Docker Buildx
49-
# uses: docker/setup-buildx-action@v3
50-
#
51-
# #Build the Docker image with cache enabled
52-
# # This step builds the image and pushes the cache to the GitHub Actions cache.
53-
# # The 'load: true' flag makes the image available to subsequent steps in the same job.
54-
# - name: Build and cache Docker image
55-
# uses: docker/build-push-action@v5
56-
# with:
57-
# context: .
58-
# file: ./tests/ublox_control/Dockerfile
59-
# load: true # Makes the image available for the next step
60-
# tags: panoseti-grpc-test-ublox-control:latest
61-
# cache-from: type=gha # Pulls cache from GitHub Actions cache
62-
# cache-to: type=gha,mode=max # Pushes cache to GitHub Actions cache
63-
#
64-
# # Run tests inside the now-cached Docker container
65-
# - name: Run Pytest in container
66-
# run: docker run --rm panoseti-grpc-test-ublox-control:latest
10+
daq-data-build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Checks-out repository
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
# Set up Docker Buildx
18+
# enables advanced features like multi-platform builds and cache management.
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
#Build the Docker image with cache enabled
23+
# This step builds the image and pushes the cache to the GitHub Actions cache.
24+
# The 'load: true' flag makes the image available to subsequent steps in the same job.
25+
- name: Build and cache Docker image
26+
uses: docker/build-push-action@v5
27+
with:
28+
context: .
29+
file: ./tests/daq_data/Dockerfile
30+
load: true # Makes the image available for the next step
31+
tags: panoseti-grpc-test-daq-data:latest
32+
cache-from: type=gha # Pulls cache from GitHub Actions cache
33+
cache-to: type=gha,mode=max # Pushes cache to GitHub Actions cache
34+
35+
# Run tests inside the now-cached Docker container
36+
- name: Run Pytest in container
37+
run: docker run --rm panoseti-grpc-test-daq-data:latest
38+
39+
ublox-control-build-and-test:
40+
runs-on: ubuntu-latest
41+
steps:
42+
# Checks-out repository
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
46+
# Set up Docker Buildx
47+
# enables advanced features like multi-platform builds and cache management.
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@v3
50+
51+
#Build the Docker image with cache enabled
52+
# This step builds the image and pushes the cache to the GitHub Actions cache.
53+
# The 'load: true' flag makes the image available to subsequent steps in the same job.
54+
- name: Build and cache Docker image
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
file: ./tests/ublox_control/Dockerfile
59+
load: true # Makes the image available for the next step
60+
tags: panoseti-grpc-test-ublox-control:latest
61+
cache-from: type=gha # Pulls cache from GitHub Actions cache
62+
cache-to: type=gha,mode=max # Pushes cache to GitHub Actions cache
63+
64+
# Run tests inside the now-cached Docker container
65+
- name: Run Pytest in container
66+
run: docker run --rm panoseti-grpc-test-ublox-control:latest
6767
real-daq-robustness-tests:
6868
name: Real DAQ Robustness Tests
6969
runs-on: ubuntu-latest
@@ -93,5 +93,5 @@ jobs:
9393
--shm-size=2g \
9494
--env RUN_REAL_DATA_TESTS=${RUN_REAL_DATA_TESTS} \
9595
panoseti-grpc-test-real-daq:latest \
96-
python3 -m pytest -v tests/daq_data_hashpipe/
96+
python3 -m pytest -s -v --maxfail=2 tests/daq_data_hashpipe/
9797

panoseti_util/stop_daq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#
1010
# On success, print OK. Otherwise print an error message
1111

12-
import os, signal
12+
import os, signal, sys
13+
sys.path.append('/app/')
1314
from panoseti_util import control_utils as util
1415

1516
def main():

tests/daq_data_hashpipe/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ SOURCES = net_thread.c \
1919

2020
INCLUDES = databuf.h compute_thread.h process_frame.h snapshot.h
2121

22-
N_INPUT_BLOCKS=4
22+
N_INPUT_BLOCKS=64
2323
N_OUTPUT_BLOCKS=1
2424

2525
all: $(TARGET)

tests/daq_data_hashpipe/conftest.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
import copy
1616
from typing import Optional, Tuple
1717

18+
from google.protobuf.struct_pb2 import Struct
19+
from google.protobuf.json_format import ParseDict
20+
1821
from daq_data.server import serve
1922
from daq_data.client import AioDaqDataClient, DaqDataClient
2023
from daq_data.daq_data_pb2 import PanoImage
21-
from google.protobuf.struct_pb2 import Struct
22-
from google.protobuf.json_format import ParseDict
24+
from panoseti_util import control_utils as util
2325

2426
TEST_CFG_DIR = Path("tests/daq_data/config")
2527
TEST_CFG_DIR.mkdir(exist_ok=True)
@@ -76,7 +78,7 @@ def hashpipe_pcap_runner():
7678
# Command to loop the pcap file to the loopback interface, simulating network traffic.
7779
tcpreplay_cmd = [
7880
"tcpreplay",
79-
"--mbps=0.5",
81+
"--mbps=1",
8082
"--loop=0", # Loop indefinitely
8183
"--intf1=lo", # Send to loopback interface
8284
pcap_file
@@ -107,11 +109,20 @@ def hashpipe_pcap_runner():
107109
)
108110

109111
# --- 4. Wait for Initialization and Validation ---
110-
time.sleep(5) # Allow time for processes to initialize and sockets to be created.
111-
if tcpreplay_proc.poll() is not None:
112-
pytest.fail(f"tcpreplay failed to start. Exit code: {tcpreplay_proc.returncode}")
113-
if hashpipe_proc.poll() is not None:
114-
pytest.fail(f"hashpipe failed to start. Exit code: {hashpipe_proc.returncode}. Check logs in {base_dir}.")
112+
num_retries = 20
113+
for i in range(num_retries):
114+
# Allow time for processes to initialize and sockets to be created.
115+
if tcpreplay_proc.poll() is not None:
116+
pytest.fail(f"tcpreplay failed to start. Exit code: {tcpreplay_proc.returncode}")
117+
elif hashpipe_proc.poll() is not None:
118+
pytest.fail(f"hashpipe failed to start. Exit code: {hashpipe_proc.returncode}. Check logs in {base_dir}.")
119+
if util.is_hashpipe_running():
120+
print(f"hashpipe is running after {i} retries.")
121+
break
122+
print(f"hashpipe is not running after {i}/{num_retries} retries. Retrying in 1 second.")
123+
time.sleep(1)
124+
else:
125+
pytest.fail(f"hashpipe failed to start after {num_retries} retries. Check logs in {base_dir}.")
115126

116127
# Yield to let the tests run
117128
yield

tests/daq_data_hashpipe/databuf.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@
2121

2222
// the size and characteristics of the input and output circular buffers
2323

24-
#define CACHE_ALIGNMENT 256
24+
#define CACHE_ALIGNMENT 16
2525
// Align the cache within the buffer
2626
#ifndef N_INPUT_BLOCKS
27-
#define N_INPUT_BLOCKS 16
27+
#define N_INPUT_BLOCKS 4
2828
#endif
2929
// Number of blocks in the input buffer
3030
#ifndef N_OUTPUT_BLOCKS
31-
#define N_OUTPUT_BLOCKS 2
31+
#define N_OUTPUT_BLOCKS 1
3232
#endif
3333
// Number of blocks in the output buffer
34-
#define IN_PKT_PER_BLOCK 16
34+
#define IN_PKT_PER_BLOCK 1
3535
// Number of input packets stored in each block of the input buffer
36-
#define OUT_MOD_PER_BLOCK 32
36+
#define OUT_MOD_PER_BLOCK 1
3737
// Max Number of Modules stored in each block of the output buffer
38-
#define OUT_PH_IMG_PER_BLOCK 32
38+
#define OUT_PH_IMG_PER_BLOCK 1
3939
// Max # of PH packets stored in each block of the output buffer
4040

4141
// Imaging Data Values and characteristics of modules

tests/daq_data_hashpipe/run_ci_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ echo "--- Running Integration Tests ---"
1212
# The RUN_REAL_DATA_TESTS=1 environment variable enables the fixture.
1313
# The --rm flag ensures the container is removed after the test run.
1414
docker run --rm \
15-
--shm-size=1g \
15+
--shm-size=2g \
1616
-e RUN_REAL_DATA_TESTS=1 \
1717
$IMAGE_NAME \
18-
python3 -m pytest -v tests/daq_data_hashpipe/
18+
python3 -m pytest -v -s --maxfail=2 tests/daq_data_hashpipe/
1919

2020
echo "--- CI Test Run Completed Successfully ---"

0 commit comments

Comments
 (0)