3939 mkdir -p ${{github.workspace}}/build
4040 cd ${{github.workspace}}/build
4141 cmake -DCONTROLLER=archon -DINSTR=hispec_tracking_camera -DDETECTOR_TYPE=Hxrg ..
42- make camerad emulator -j$(nproc)
42+ make camerad emulator socksend -j$(nproc)
4343
4444 - name : CryoScope synthetic test
4545 run : |
@@ -48,38 +48,16 @@ jobs:
4848 bin/camerad --foreground --config Config/cryoscope/cryoscope.cfg &
4949 sleep 3
5050
51- python3 << 'EOF'
52- import socket, sys
51+ send() { bin/socksend -p 3031 -t 60 "$1"; }
5352
54- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
55- s.settimeout(120)
56- s.connect(('localhost', 3031))
57-
58- def cmd(c):
59- s.sendall((c + '\n').encode())
60- data = b''
61- while True:
62- try:
63- chunk = s.recv(4096)
64- if not chunk: break
65- data += chunk
66- if b'\n' in data: break
67- except socket.timeout:
68- break
69- return data.decode().strip()
70-
71- failed = False
72- for c in ['open', 'load', 'power on', 'mode VIDEORXR', 'exptime 0.1',
73- 'exposuremode SINGLE', 'expose 1']:
74- resp = cmd(c)
75- status = 'OK' if 'DONE' in resp else 'FAIL'
76- print(f' {status}: {c} -> {resp}')
77- if status == 'FAIL':
78- failed = True
79-
80- s.close()
81- sys.exit(1 if failed else 0)
82- EOF
53+ send "open"
54+ send "load"
55+ send "power on"
56+ send "mode VIDEORXR"
57+ send "exptime 0.1"
58+ resp=$(send "expose 1")
59+ echo "expose -> $resp"
60+ echo "$resp" | grep -q "DONE" || exit 1
8361
8462 pkill -f 'bin/camerad' || true
8563 pkill -f 'bin/emulator' || true
@@ -95,38 +73,16 @@ jobs:
9573 bin/camerad --foreground --config /tmp/cryoscope_fits_test.cfg &
9674 sleep 3
9775
98- python3 << 'EOF'
99- import socket, sys
100-
101- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
102- s.settimeout(120)
103- s.connect(('localhost', 3031))
104-
105- def cmd(c):
106- s.sendall((c + '\n').encode())
107- data = b''
108- while True:
109- try:
110- chunk = s.recv(4096)
111- if not chunk: break
112- data += chunk
113- if b'\n' in data: break
114- except socket.timeout:
115- break
116- return data.decode().strip()
117-
118- failed = False
119- for c in ['open', 'load', 'power on', 'mode VIDEORXR', 'exptime 0.1',
120- 'exposuremode SINGLE', 'expose 1']:
121- resp = cmd(c)
122- status = 'OK' if 'DONE' in resp else 'FAIL'
123- print(f' {status}: {c} -> {resp}')
124- if status == 'FAIL':
125- failed = True
76+ send() { bin/socksend -p 3031 -t 60 "$1"; }
12677
127- s.close()
128- sys.exit(1 if failed else 0)
129- EOF
78+ send "open"
79+ send "load"
80+ send "power on"
81+ send "mode VIDEORXR"
82+ send "exptime 0.1"
83+ resp=$(send "expose 1")
84+ echo "expose -> $resp"
85+ echo "$resp" | grep -q "DONE" || exit 1
13086
13187 pkill -f 'bin/camerad' || true
13288 pkill -f 'bin/emulator' || true
0 commit comments