Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
1935 lines (1711 loc) · 91.8 KB
/
Copy pathMakefile
File metadata and controls
1935 lines (1711 loc) · 91.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# perfcached - top-level Makefile: the daemon, its tools, libperfd and the test suites
CC ?= gcc
# the daemon resets /stats on a schedule, and a suite spanning midnight would see its counters
# restart: every suite started from make runs with it off (statsschedtest unsets this)
export PERFCACHED_STATS_RESET ?= off
# config.mk (make menuconfig) first: it names the edition, the allocator and the build FLAVOR,
# and the flavor decides the optimisation flags.
-include config.mk
# the build flavor: release (-O2 -g, the default), debug (-Og -g3, frame pointers, arena checks),
# asan (debug + ASan/UBSan, runtimes linked statically); CFLAGS or SAN on the command line win.
PC_BUILD ?= release
ifeq ($(PC_BUILD),release)
CFLAGS ?= -O2 -g
else ifeq ($(PC_BUILD),debug)
CFLAGS ?= -Og -g3 -fno-omit-frame-pointer
else ifeq ($(PC_BUILD),asan)
CFLAGS ?= -Og -g3 -fno-omit-frame-pointer
SAN ?= -fsanitize=address,undefined -fno-omit-frame-pointer \
$(if $(findstring clang,$(shell $(CC) --version 2>/dev/null)),-static-libsan,-static-libasan -static-libubsan)
else
$(error PC_BUILD must be release, debug or asan, not '$(PC_BUILD)' - run make menuconfig)
endif
ifneq ($(PC_BUILD),release)
CFLAGS += -DPCACHE_ARENA_DEBUG
endif
PC_BUILD_EFF = $(if $(SAN),asan,$(PC_BUILD))
CFLAGS += -std=gnu11 -Wall -Wextra -Werror -D_FILE_OFFSET_BITS=64
# SAN: sanitizer flags injected into BOTH compile and link (a sanitizer that reaches only one
# of them links clean and checks nothing); `make check-asan` and CI set it.
CFLAGS += $(SAN)
LDLIBS = $(SAN) -lpthread -lsodium
# never hardcode ISA extensions here - runtime dispatch decides.
PC_BUILD_REV := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
CFLAGS += -DPC_BUILD_REV=\"$(PC_BUILD_REV)\" -DPC_BUILD_FLAVOR=\"$(PC_BUILD_EFF)\"
# The vendored core builds as close to upstream as possible: the two warning classes upstream
# trips under -Wextra are excepted; every other class still fails the build.
CORE_WNO = -Wno-unused-parameter -Wno-sign-compare
CORE_OBJS = src/core/pcache_mem.o src/core/pcache_htable.o src/core/pcache_arena.o \
src/core/pcache_opool.o
# the EDITION (config.mk; clustered by default): standalone links cluster_stub.o in place of
# cluster.c and the cl*.c modules - a clustered daemon with no [cluster] section, minus the code.
PC_EDITION ?= clustered
CLUSTER_OBJS = src/cluster.o src/clmap.o src/clterm.o src/clsync.o src/clhist.o \
src/clplace.o src/clsel.o src/clpeers.o src/clpend.o src/clloc.o \
src/clboot.o src/clpush.o src/clwire.o src/clbulk.o src/clwork.o \
src/clmig.o src/clapply.o src/clfwd.o src/clinit.o src/clres.o \
src/clmemb.o src/clpull.o src/clhold.o src/clrecon.o src/clepoch.o src/clcol.o src/clplat.o src/clsend.o \
src/clfleet.o src/clps.o src/clspread.o src/clcid.o \
src/clmesh.o src/clane.o src/clorder.o src/clrp.o src/clrpt.o src/clreplay.o \
src/clrecv.o src/cltomb.o src/cladmit.o src/clfound.o src/clddl.o src/clconn.o \
src/statefile.o
ifeq ($(PC_EDITION),standalone)
EDITION_OBJS = src/cluster_stub.o
CFLAGS += -DPC_EDITION_STANDALONE
else ifeq ($(PC_EDITION),clustered)
EDITION_OBJS = $(CLUSTER_OBJS)
else
$(error PC_EDITION must be standalone or clustered, not '$(PC_EDITION)' - run make menuconfig)
endif
# the ALLOCATOR: libc, or mimalloc/jemalloc linked AHEAD of the C library to serve the whole process;
# mimalloc pinned to major 2 (3.0 measured slower on the JSON path), its insecure build preferred.
PC_ALLOC ?= libc
ifneq ($(SAN),)
PC_ALLOC_LIB =
PC_ALLOC_EFF = libc
else ifeq ($(PC_ALLOC),libc)
PC_ALLOC_LIB =
PC_ALLOC_EFF = libc
else ifeq ($(PC_ALLOC),mimalloc)
PC_ALLOC_LIB := $(firstword $(wildcard /usr/lib/libmimalloc-insecure.so.2 \
/usr/lib/*/libmimalloc-insecure.so.2 /usr/local/lib/libmimalloc-insecure.so.2 \
/usr/lib/libmimalloc.so.2 /usr/lib/*/libmimalloc.so.2 /usr/local/lib/libmimalloc.so.2))
PC_ALLOC_EFF = mimalloc
ifeq ($(PC_ALLOC_LIB),)
$(error PC_ALLOC=mimalloc: no libmimalloc(-insecure).so.2 found - install mimalloc 2.x (Alpine: apk add mimalloc2-insecure), or PC_ALLOC=libc)
endif
else ifeq ($(PC_ALLOC),jemalloc)
PC_ALLOC_LIB := $(firstword $(wildcard /usr/lib/libjemalloc.so.2 \
/usr/lib/*/libjemalloc.so.2 /usr/local/lib/libjemalloc.so.2))
PC_ALLOC_EFF = jemalloc
ifeq ($(PC_ALLOC_LIB),)
$(error PC_ALLOC=jemalloc: no libjemalloc.so.2 found - install jemalloc (Alpine: apk add jemalloc; Debian: libjemalloc2), or PC_ALLOC=libc)
endif
else
$(error PC_ALLOC must be libc, mimalloc or jemalloc, not '$(PC_ALLOC)' - run make menuconfig)
endif
CFLAGS += -DPC_ALLOC_NAME=\"$(PC_ALLOC_EFF)\"
LDLIBS := $(PC_ALLOC_LIB) $(LDLIBS)
# MAIL, the alert mailer's transport: none (the default; -C refuses a [mail] section) or libcurl,
# a dependency only the builds that ask for it carry (libcurl4-openssl-dev, Alpine curl-dev).
PC_MAIL ?= none
ifeq ($(PC_MAIL),libcurl)
ifeq ($(shell pkg-config --exists libcurl 2>/dev/null && echo yes),)
$(error PC_MAIL=libcurl: libcurl not found by pkg-config - install libcurl4-openssl-dev (Alpine: curl-dev), or PC_MAIL=none)
endif
CFLAGS += -DPC_MAIL_CURL $(shell pkg-config --cflags libcurl)
LDLIBS += $(shell pkg-config --libs libcurl)
else ifneq ($(PC_MAIL),none)
$(error PC_MAIL must be none or libcurl, not '$(PC_MAIL)' - run make menuconfig)
endif
# TLS on the RESP and HTTP doors through OpenSSL (libssl-dev, Alpine openssl-dev), daemon only;
# auto (the default) builds it when pkg-config finds openssl; yes insists; no skips.
PC_TLS ?= auto
ifeq ($(PC_TLS),auto)
PC_TLS := $(if $(shell pkg-config --exists openssl 2>/dev/null && echo yes),yes,no)
endif
ifeq ($(PC_TLS),yes)
ifeq ($(shell pkg-config --exists openssl 2>/dev/null && echo yes),)
$(error PC_TLS=yes: openssl not found by pkg-config - install libssl-dev (Alpine: openssl-dev), or PC_TLS=no)
endif
CFLAGS += -DPC_TLS $(shell pkg-config --cflags openssl)
TLS_LIBS = $(shell pkg-config --libs openssl)
else ifneq ($(PC_TLS),no)
$(error PC_TLS must be auto, yes or no, not '$(PC_TLS)')
endif
# perfcached-dashboard: the status page in its own process over libperfd, on libmicrohttpd
# (libmicrohttpd-dev); auto builds it when pkg-config finds the library, yes insists, no skips.
PC_DASH ?= auto
ifeq ($(PC_DASH),auto)
PC_DASH := $(if $(shell pkg-config --exists libmicrohttpd 2>/dev/null && echo yes),yes,no)
endif
ifeq ($(PC_DASH),yes)
ifeq ($(shell pkg-config --exists libmicrohttpd 2>/dev/null && echo yes),)
$(error PC_DASH=yes: libmicrohttpd not found by pkg-config - install libmicrohttpd-dev, or PC_DASH=no)
endif
DASH_CFLAGS = $(shell pkg-config --cflags libmicrohttpd)
DASH_LIBS = $(shell pkg-config --libs libmicrohttpd)
DASH_BIN = perfcached-dashboard
DASH_TEST = dashlocktest
else ifneq ($(PC_DASH),no)
$(error PC_DASH must be auto, yes or no, not '$(PC_DASH)')
endif
all: shim core perfcached perfcli perfdump perfload libperfd.a $(DASH_BIN)
# choose the edition (writes config.mk)
menuconfig:
@sh tools/menuconfig.sh
# the standalone edition's gate: every suite that needs no cluster (test/standalone.suites),
# in order, stopping at the first failure; CI runs it on the standalone build.
check-standalone: selftest verstamptest perfcached perfcli perfdump perfload pagedump \
pcbench libtest wedgetest asynctest asyncbintest pubsubcli \
udppushcli rpsbench syncfailshim.so allocshim.so liballoc noisetest \
libperfd.a libperfd.so abicaller libtest-so
./selftest
./verstamptest
@grep -vE '^#|^$$' test/standalone.suites | while read -r line; do \
echo "== $$line"; sh -c "$$line" || exit 1; done
perfcached: src/main.o src/tls.o src/config.o src/cfgcore.o src/cfgcluster.o src/cfgops.o src/cfgcheck.o src/daemon.o src/doorlive.o src/listenfd.o src/cfgsig.o src/autosize.o src/addrwait.o src/dirlock.o src/proto.o src/httpdoor.o src/respdoor.o src/enumwalk.o src/noisechan.o src/json.o \
src/pc_noise.o src/verbs.o src/jsonpath.o src/hashrec.o src/sha1.o src/ptree.o src/store.o src/storage.o \
src/walprobe.o src/wal.o src/walscan.o src/crc32c.o src/rdb.o src/recover.o $(EDITION_OBJS) \
src/node.o src/clretain.o src/clack.o src/clackf.o src/ackstate.o src/clunk.o src/pcaddr.o \
src/obs.o src/metrics.o src/events.o src/quiesce.o src/psindex.o src/pubsub.o src/upstream.o src/upjson.o src/upstats.o src/upconn.o src/upsentinel.o src/upcluster.o src/uptls.o src/uprespc.o src/respout.o src/respcl.o src/resppubsub.o src/respkv.o src/respjson.o src/respscript.o src/respsrv.o src/respscan.o src/pcglob.o src/statstree.o src/statscluster.o src/statsreset.o src/winctr.o src/memguard.o src/mail.o src/alerts.o src/hostmon.o src/hostlink.o src/iostat.o src/uring.o src/busypoll.o src/upgrade.o src/upgverify.o src/logrl.o src/relkey.o src/reload.o src/respmap.o src/mgetfan.o src/presence.o src/keeps.o $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS) $(TLS_LIBS)
# src/core/*.h belongs here: the daemon's sources read the core's constants (VAL_MAX is
# PCACHE_CELL_MAX), and objects built before a core header change would disagree about them.
src/%.o: src/%.c src/*.h src/core/*.h src/compat/*.h $(wildcard config.mk)
$(CC) $(CFLAGS) -Isrc -c -o $@ $<
# the compatibility shim the vendored core compiles against
shim: src/compat/compat.o
src/compat/compat.o: src/compat/compat.c src/compat/*.h $(wildcard config.mk)
$(CC) $(CFLAGS) -c -o $@ $<
# the vendored core (see tools/sync-core.sh; provenance in each file)
core: $(CORE_OBJS)
src/core/%.o: src/core/%.c src/core/*.h src/compat/*.h $(wildcard config.mk)
$(CC) $(CFLAGS) $(CORE_WNO) -c -o $@ $<
# the cluster map format: parses bytes off the network, so it is kept
# free of cluster.c and unit-tested on its own
clmaptest: test/clmaptest.c src/clmap.o
$(CC) $(CFLAGS) -o $@ test/clmaptest.c src/clmap.o
# the page's bytes for the tests, from the object the dashboard links
pagedump: test/pagedump.c src/statuspage.o src/statuspage.h
$(CC) $(CFLAGS) -o $@ test/pagedump.c src/statuspage.o
# the mastership term: persistence plus the three ordering rules
cltermtest: test/cltermtest.c src/clterm.o src/statefile.o
$(CC) $(CFLAGS) -o $@ test/cltermtest.c src/clterm.o src/statefile.o
# the peer table: liveness at the boundary, slot reuse, duplicate ids
clpeerstest: test/clpeerstest.c src/pcaddr.o src/clpeers.o
$(CC) $(CFLAGS) -o $@ test/clpeerstest.c src/pcaddr.o src/clpeers.o
# parked requests + the completion queues: handles, occupancy, expiry
clpendtest: test/clpendtest.c src/clpend.o src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/clpendtest.c src/clpend.o src/compat/compat.o -lpthread
clmigtest: test/clmigtest.c src/clmig.o
$(CC) $(CFLAGS) -o $@ test/clmigtest.c src/clmig.o
# the sharded apply rings, without a daemon
clapplytest: test/clapplytest.c src/pcaddr.o src/clapply.o
$(CC) $(CFLAGS) -o $@ test/clapplytest.c src/pcaddr.o src/clapply.o $(LDLIBS)
clfwdtest: test/clfwdtest.c src/clfwd.o
$(CC) $(CFLAGS) -o $@ test/clfwdtest.c src/clfwd.o
clinittest: test/clinittest.c src/clinit.o src/fnv1a.h
$(CC) $(CFLAGS) -o $@ test/clinittest.c src/clinit.o
# the locator and negative caches: TTL decay, the tombstone pair, 4-way
clloctest: test/clloctest.c src/clloc.o src/fnv1a.h
$(CC) $(CFLAGS) -o $@ test/clloctest.c src/clloc.o
# the retained-tombstone table
clretaintest: test/clretaintest.c src/clretain.o
$(CC) $(CFLAGS) -o $@ test/clretaintest.c src/clretain.o $(LDLIBS)
# the watermarks - contiguous, durable, gaps, the model
clacktest: test/clacktest.c src/clack.o
$(CC) $(CFLAGS) -o $@ test/clacktest.c src/clack.o
# the members' announced marks - incarnations, the lowest, the bounds
clackftest: test/clackftest.c src/clackf.o
$(CC) $(CFLAGS) -o $@ test/clackftest.c src/clackf.o
# the address type
pcaddrtest: test/pcaddrtest.c src/pcaddr.o
$(CC) $(CFLAGS) -o $@ test/pcaddrtest.c src/pcaddr.o $(LDLIBS)
# the upstream's RESP reply parser, without a daemon
uprespctest: test/uprespctest.c src/uprespc.o src/uprespc.h
$(CC) $(CFLAGS) -o $@ test/uprespctest.c src/uprespc.o $(LDLIBS)
# the RESP door's reply writers
respouttest: test/respouttest.c src/respout.o src/respout.h src/json.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/respouttest.c src/respout.o src/json.o \
src/compat/compat.o $(LDLIBS)
# the RESP door's CLUSTER commands, the fleet stubbed
respcltest: test/respcltest.c src/respcl.o src/respout.o src/json.o src/compat/compat.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respcltest.c src/respcl.o src/respout.o \
src/json.o src/compat/compat.o $(LDLIBS) -lpthread
# the RESP door's pub/sub, the engine stubbed
resppubsubtest: test/resppubsubtest.c src/resppubsub.o src/respout.o src/json.o src/compat/compat.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/resppubsubtest.c src/resppubsub.o \
src/respout.o src/json.o src/compat/compat.o $(LDLIBS)
# the RESP door's key-value commands over a fake store
# (no compat.o: the test owns the clock)
respkvtest: test/respkvtest.c src/respkv.o src/respout.o src/json.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respkvtest.c src/respkv.o src/respout.o \
src/json.o $(LDLIBS)
# RedisJSON on the RESP door, the JSON core stubbed
respjsontest: test/respjsontest.c src/respjson.o src/respout.o src/jsonpath.o src/json.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respjsontest.c src/respjson.o src/respout.o \
src/jsonpath.o src/json.o $(LDLIBS)
# EVAL / EVALSHA / SCRIPT, the lock core stubbed, SHA1 real
respscripttest: test/respscripttest.c src/respscript.o src/respout.o src/sha1.o src/json.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respscripttest.c src/respscript.o src/respout.o \
src/sha1.o src/json.o $(LDLIBS)
# PING / AUTH / HELLO / INFO / TIME, the store and observers stubbed
respsrvtest: test/respsrvtest.c src/respsrv.o src/respout.o src/json.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respsrvtest.c src/respsrv.o src/respout.o \
src/json.o $(LDLIBS)
# SCAN and KEYS' turn over a fake table
respscantest: test/respscantest.c src/respscan.o src/pcglob.o src/respout.o src/json.o src/verbsint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respscantest.c src/respscan.o src/pcglob.o \
src/respout.o src/json.o $(LDLIBS)
# the read-through's figures, the upstream's state stubbed
upstatstest: test/upstatstest.c src/upstats.o src/ptree.o src/json.o src/winctr.o src/compat/compat.o src/upstreamint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/upstatstest.c src/upstats.o src/ptree.o src/json.o \
src/winctr.o src/compat/compat.o $(LDLIBS)
# the read-through's RESP client over a socketpair
upconntest: test/upconntest.c src/upconn.o src/uprespc.o src/upstreamint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/upconntest.c src/upconn.o src/uprespc.o $(LDLIBS)
# the reconcile's pacing, pure
clrecontest: test/clrecontest.c src/clrecon.o src/clrecon.h src/clpeers.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clrecontest.c src/clrecon.o
# the metrics door, proto.c's staging captured
httpdoortest: test/httpdoortest.c src/httpdoor.o src/ptree.o src/json.o src/pcaddr.o src/protoint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/httpdoortest.c src/httpdoor.o src/ptree.o src/json.o \
src/pcaddr.o $(LDLIBS)
# one mget waiting on several lookups, the cluster and the store stubbed
mgetaggtest: test/mgetaggtest.c src/mgetfan.o src/ptree.o src/json.o src/respout.o src/mgetfan.h
$(CC) $(CFLAGS) -Isrc -o $@ test/mgetaggtest.c src/mgetfan.o src/ptree.o \
src/json.o src/respout.o $(LDLIBS)
# the RESP door's framing, the verb layer stubbed
respdoortest: test/respdoortest.c src/respdoor.o src/json.o src/protoint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respdoortest.c src/respdoor.o src/json.o $(LDLIBS)
# the cooperative KEYS walk, the connection's life stubbed
enumwalktest: test/enumwalktest.c src/enumwalk.o src/json.o src/protoint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/enumwalktest.c src/enumwalk.o src/json.o $(LDLIBS)
# the Noise channel's responder side, against pc_noise's initiator
noisechantest: test/noisechantest.c src/noisechan.o src/pc_noise.o src/pcaddr.o src/protoint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/noisechantest.c src/noisechan.o src/pc_noise.o src/pcaddr.o $(LDLIBS)
# the cluster wire epoch, clstate.h stubbed
clepochtest: test/clepochtest.c src/clepoch.o src/clepoch.h src/clstate.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clepochtest.c src/clepoch.o
clfoundtest: test/clfoundtest.c src/clfound.o src/pcaddr.o src/clfound.h src/clstate.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clfoundtest.c src/clfound.o src/pcaddr.o
cladmittest: test/cladmittest.c src/cladmit.o src/clpeers.o src/clmemb.o src/pcaddr.o src/cladmit.h src/clstate.h src/clconn.h
$(CC) $(CFLAGS) -Isrc -o $@ test/cladmittest.c src/cladmit.o src/clpeers.o src/clmemb.o src/pcaddr.o -lpthread
clconntest: test/clconntest.c src/clconn.o src/pcaddr.o src/clconn.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clconntest.c src/clconn.o src/pcaddr.o
clddltest: test/clddltest.c src/clddl.o src/clcol.o src/pcaddr.o src/clddl.h src/clstate.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clddltest.c src/clddl.o src/clcol.o src/pcaddr.o -lpthread
cfgkvtest: test/cfgkvtest.c src/config.o src/cfgcore.o src/cfgcluster.o src/cfgops.o src/cfgcheck.o src/pcaddr.o src/relkey.o src/compat/compat.o src/configint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/cfgkvtest.c src/config.o src/cfgcore.o src/cfgcluster.o src/cfgops.o src/cfgcheck.o src/pcaddr.o src/relkey.o src/compat/compat.o $(LDLIBS)
cfgchecktest: test/cfgchecktest.c src/cfgcheck.o src/config.o src/cfgcore.o src/cfgcluster.o src/cfgops.o src/pcaddr.o src/relkey.o src/configint.h
$(CC) $(CFLAGS) -Isrc -o $@ test/cfgchecktest.c src/cfgcheck.o src/config.o src/cfgcore.o src/cfgcluster.o src/cfgops.o src/pcaddr.o src/relkey.o $(LDLIBS)
doorlivetest: test/doorlivetest.c src/doorlive.o src/pcaddr.o src/doorlive.h
$(CC) $(CFLAGS) -Isrc -o $@ test/doorlivetest.c src/doorlive.o src/pcaddr.o $(LDLIBS)
listenfdtest: test/listenfdtest.c src/listenfd.o src/pcaddr.o src/listenfd.h
$(CC) $(CFLAGS) -Isrc -o $@ test/listenfdtest.c src/listenfd.o src/pcaddr.o $(LDLIBS)
cfgsigtest: test/cfgsigtest.c src/cfgsig.o src/cfgsig.h
$(CC) $(CFLAGS) -Isrc -o $@ test/cfgsigtest.c src/cfgsig.o
autosizetest: test/autosizetest.c src/autosize.o src/autosize.h
$(CC) $(CFLAGS) -Isrc -o $@ test/autosizetest.c src/autosize.o
hostmontest: test/hostmontest.c src/hostmon.o src/hostmon.h
$(CC) $(CFLAGS) -Isrc -o $@ test/hostmontest.c src/hostmon.o
# the link monitor against a fake /sys and /proc
hostlinktest: test/hostlinktest.c src/hostlink.o src/hostlink.h src/hostmon.h
$(CC) $(CFLAGS) -Isrc -o $@ test/hostlinktest.c src/hostlink.o
crc32ctest: test/crc32ctest.c src/crc32c.o src/crc32c.h
$(CC) $(CFLAGS) -Isrc -o $@ test/crc32ctest.c src/crc32c.o
walscantest: test/walscantest.c src/walscan.o src/crc32c.o src/walfmt.h src/wal.h
$(CC) $(CFLAGS) -Isrc -o $@ test/walscantest.c src/walscan.o src/crc32c.o
upgverifytest: test/upgverifytest.c src/upgverify.o src/relkey.o src/upgrade.h
$(CC) $(CFLAGS) -Isrc -o $@ test/upgverifytest.c src/upgverify.o src/relkey.o $(LDLIBS)
clanetest: test/clanetest.c src/clane.o src/pcaddr.o src/clane.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clanetest.c src/clane.o src/pcaddr.o -lpthread
logrltest: test/logrltest.c src/logrl.o src/pcaddr.o src/logrl.h
$(CC) $(CFLAGS) -Isrc -o $@ test/logrltest.c src/logrl.o src/pcaddr.o -lpthread
clmeshtest: test/clmeshtest.c src/clmesh.o src/pcaddr.o src/clmesh.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clmeshtest.c src/clmesh.o src/pcaddr.o -lpthread
# the key glob
pcglobtest: test/pcglobtest.c src/pcglob.o src/pcglob.h
$(CC) $(CFLAGS) -o $@ test/pcglobtest.c src/pcglob.o
# the stats reset and its schedule, the planes stubbed
statsresettest: test/statsresettest.c src/statsreset.o src/statsreset.h
$(CC) $(CFLAGS) -Isrc -o $@ test/statsresettest.c src/statsreset.o $(LDLIBS)
# id reservations: the expiry boundary, identity-before-address, the
# eviction choice - all of it invisible on a healthy fleet
clrestest: test/clrestest.c src/clres.o src/clres.h
$(CC) $(CFLAGS) -o $@ test/clrestest.c src/clres.o
# the keepalive frames, checked DIFFERENTIALLY against the pre-extraction
# layout - MASTER_ALIVE is what master-down detection runs on
clmembtest: test/clmembtest.c src/clmemb.o src/clmemb.h src/clcodec.h
$(CC) $(CFLAGS) -o $@ test/clmembtest.c src/clmemb.o
# the unknown-command table, its frame and the fleet fold
clunktest: test/clunktest.c src/clunk.o src/clunk.h src/clcodec.h
$(CC) $(CFLAGS) -o $@ test/clunktest.c src/clunk.o
# the fleet's collection figures, the rules without the peer table
clfleettest: test/clfleettest.c src/clfleet.o src/clfleet.h src/clmemb.h
$(CC) $(CFLAGS) -o $@ test/clfleettest.c src/clfleet.o
# the worker entry points and the write-path push on the real clwork/clpend/clsend/clpush/clmig
# objects; the test itself supplies cluster.c's accessors (clstate.h)
clworktest: test/clworktest.c src/pcaddr.o src/clwork.o src/clpend.o src/clsend.o src/clpeers.o src/clwire.o src/clplace.o src/clmap.o src/clpull.o src/clfwd.o src/clpush.o src/clmig.o src/iostat.o src/clrp.o src/clrpt.o
$(CC) $(CFLAGS) -o $@ test/clworktest.c src/pcaddr.o src/clwork.o src/clpend.o src/clsend.o src/clpeers.o src/clwire.o src/clplace.o src/clmap.o src/clpull.o src/clfwd.o src/clpush.o src/clmig.o src/iostat.o src/clrp.o src/clrpt.o -lsodium -lpthread
# the pub/sub relay plane on the real clps/clsend/clpeers/psindex/quiesce objects; the test supplies
# the accessors and callbacks and captures the transmit - nothing binds a socket
clpstest: test/clpstest.c src/pcaddr.o src/clps.o src/clsend.o src/clpeers.o src/clwire.o src/clreplay.o src/psindex.o src/quiesce.o src/iostat.o src/clrp.o src/clrpt.o src/clmig.o src/clps.h
$(CC) $(CFLAGS) -o $@ test/clpstest.c src/pcaddr.o src/clps.o src/clsend.o src/clpeers.o src/clwire.o src/clreplay.o src/psindex.o src/quiesce.o src/iostat.o src/clrp.o src/clrpt.o src/clmig.o -lsodium -lpthread
# spread's decisions on the real clspread/clplace objects; placement's
# answers are the test's own
clspreadtest: test/clspreadtest.c src/pcaddr.o src/clspread.o src/clplace.o src/clmap.o src/clspread.h
$(CC) $(CFLAGS) -o $@ test/clspreadtest.c src/pcaddr.o src/clspread.o src/clplace.o src/clmap.o
# the send path (clsend), no socket - the transmit is captured
clsendtest: test/clsendtest.c src/pcaddr.o src/clsend.o src/clpeers.o src/clwire.o src/iostat.o src/clsend.h
$(CC) $(CFLAGS) -o $@ test/clsendtest.c src/pcaddr.o src/clsend.o src/clpeers.o src/clwire.o src/iostat.o -lsodium -lpthread
# the PULL plane: a store miss asks a peer, and the VERSION rides back
# with the bytes - checked against the pre-extraction layout
clpulltest: test/clpulltest.c src/clpull.o src/clpull.h src/clcodec.h
$(CC) $(CFLAGS) -o $@ test/clpulltest.c src/clpull.o
# the hold-check frames
clholdtest: test/clholdtest.c src/clhold.o src/clhold.h src/clmsg.h
$(CC) $(CFLAGS) -o $@ test/clholdtest.c src/clhold.o
# the collection announce: four ops in one frame, and RENAME carries a
# second name the other three do not
clcoltest: test/clcoltest.c src/clcol.o src/clcol.h src/clcodec.h
$(CC) $(CFLAGS) -o $@ test/clcoltest.c src/clcol.o
# platform-derived identity: a clone must not inherit a member's identity
clplattest: test/clplattest.c src/clplat.o src/clplat.h
$(CC) $(CFLAGS) -o $@ test/clplattest.c src/clplat.o -lsodium
# the bootstrap decision: rounds, deadlines, the handoff
clboottest: test/clboottest.c src/pcaddr.o src/clboot.o
$(CC) $(CFLAGS) -o $@ test/clboottest.c src/pcaddr.o src/clboot.o -lpthread
# the write-path push groups: per-thread, the two send points, the flush
clpushtest: test/clpushtest.c src/pcaddr.o src/clpush.o
$(CC) $(CFLAGS) -o $@ test/clpushtest.c src/pcaddr.o src/clpush.o -lpthread
# the sealed datagram and the beat frames: round trip, tamper, wrong key
clwiretest: test/clwiretest.c src/clwire.o
$(CC) $(CFLAGS) -o $@ test/clwiretest.c src/clwire.o -lsodium -lpthread
# a sealed frame is taken once - the stream window, incarnations, the header
clreplaytest: test/clreplaytest.c src/clreplay.o src/clwire.o
$(CC) $(CFLAGS) -o $@ test/clreplaytest.c src/clreplay.o src/clwire.o -lsodium -lpthread
# replication groups over TCP - framing, the queue's bound, refusals
clrpttest: test/clrpttest.c src/clrpt.o src/pcaddr.o src/clrpt.h
$(CC) $(CFLAGS) -Isrc -o $@ test/clrpttest.c src/clrpt.o src/pcaddr.o $(LDLIBS)
# the bulk plane's framing and batch handoff: round trip, truncation, handoff
clbulktest: test/clbulktest.c src/pcaddr.o src/clbulk.o src/pc_noise.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/clbulktest.c src/pcaddr.o src/clbulk.o src/pc_noise.o \
src/compat/compat.o $(LDLIBS)
# staging a map change past the backup: ack before publish
clsynctest: test/clsynctest.c src/clsync.o
$(CC) $(CFLAGS) -o $@ test/clsynctest.c src/clsync.o
# the identity history: what separates a new node from a returning one
clhisttest: test/clhisttest.c src/clhist.o
$(CC) $(CFLAGS) -o $@ test/clhisttest.c src/clhist.o
# placement over the map: weighted rendezvous, in integers so every node
# reaches the same answer
clplacetest: test/clplacetest.c src/clplace.o src/clmap.o src/pc_slot.h
$(CC) $(CFLAGS) -o $@ test/clplacetest.c src/clplace.o src/clmap.o
# client-side selection: the spread property, without needing a fleet
clseltest: test/clseltest.c src/clsel.o src/clmap.o
$(CC) $(CFLAGS) -o $@ test/clseltest.c src/clsel.o src/clmap.o
# the mastership state machine under seed-replayable schedules, linking the SHIPPED decision
# functions: the simulation is the protocol around them, never a reimplementation of them.
clustersim: test/clustersim.c src/clterm.o src/clmap.o src/statefile.o
$(CC) $(CFLAGS) -o $@ test/clustersim.c src/clterm.o src/clmap.o src/statefile.o
# the reply writer, including the heap mode CLUSTER SLOTS needs
jwtest: test/jwtest.c src/json.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/jwtest.c src/json.o \
src/compat/compat.o $(LDLIBS)
# the WAL pump's ring copy against the byte loop it replaced
walringtest: test/walringtest.c src/walring.h
$(CC) $(CFLAGS) -Isrc -o $@ test/walringtest.c
rpcqtest: test/rpcqtest.c src/rpcq.h
$(CC) $(CFLAGS) -Isrc -o $@ test/rpcqtest.c
# the node's state set from two threads (node.c, its test hook)
nodetest: test/nodetest.c src/node.c src/cluster.h src/compat/compat.c
$(CC) $(CFLAGS) -DPC_TESTHOOKS -Isrc -o $@ test/nodetest.c src/node.c src/compat/compat.c $(LDLIBS)
clprobetest: test/clprobetest.c src/clprobe.h src/pcaddr.o
$(CC) $(CFLAGS) -Isrc -o $@ test/clprobetest.c src/pcaddr.o $(LDLIBS)
thrtabtest: test/thrtabtest.c src/thrtab.h src/clapply.h
$(CC) $(CFLAGS) -Isrc -o $@ test/thrtabtest.c
promlabeltest: test/promlabeltest.c src/promlabel.h
$(CC) $(CFLAGS) -Isrc -o $@ test/promlabeltest.c
upjsontest: test/upjsontest.c src/upjson.o src/json.o src/compat/compat.o src/upjson.h
$(CC) $(CFLAGS) -Isrc -o $@ test/upjsontest.c src/upjson.o src/json.o src/compat/compat.o $(LDLIBS)
psindextest: test/psindextest.c src/psindex.o
$(CC) $(CFLAGS) -Isrc -o $@ test/psindextest.c src/psindex.o
psudptest: test/psudptest.c src/psudp.h lib/perfd_push.h
$(CC) $(CFLAGS) -Isrc -o $@ test/psudptest.c
psinteresttest: test/psinteresttest.c src/psinterest.h
$(CC) $(CFLAGS) -Isrc -o $@ test/psinteresttest.c
psrelaytest: test/psrelaytest.c src/psrelay.h
$(CC) $(CFLAGS) -Isrc -o $@ test/psrelaytest.c
slottest: test/slottest.c src/pc_slot.h src/pc_mix.h
$(CC) $(CFLAGS) -Isrc -o $@ test/slottest.c $(LDLIBS)
udppushcli: test/udppushcli.c lib/perfd.h lib/perfd_push.h libperfd.a
$(CC) $(CFLAGS) -Ilib -o $@ test/udppushcli.c libperfd.a $(LDLIBS)
pubsubcli: test/pubsubcli.c lib/perfd.h libperfd.a
$(CC) $(CFLAGS) -Ilib -o $@ test/pubsubcli.c libperfd.a $(LDLIBS)
natbench: bench/natbench.c lib/perfd.h libperfd.a
$(CC) $(CFLAGS) -o $@ bench/natbench.c libperfd.a $(LDLIBS)
psqueuetest: test/psqueuetest.c src/pubsub.o src/psindex.o src/quiesce.o src/pubsub.h
$(CC) $(CFLAGS) -Isrc -o $@ test/psqueuetest.c src/pubsub.o src/psindex.o src/quiesce.o -lpthread
psengine: bench/psengine.c src/pubsub.o src/psindex.o src/quiesce.o src/pubsub.h
$(CC) $(CFLAGS) -Isrc -o $@ bench/psengine.c src/pubsub.o src/psindex.o src/quiesce.o -lpthread
psbench: bench/psbench.c lib/perfd.h libperfd.a
$(CC) $(CFLAGS) -o $@ bench/psbench.c libperfd.a $(LDLIBS)
# the pub/sub soak driver: publishers, subscribers (exact, pattern, UDP
# push) and churn that survive a node restart - see bench/pssoak.c
pssoak: bench/pssoak.c lib/perfd.h libperfd.a
$(CC) $(CFLAGS) -Ilib -o $@ bench/pssoak.c libperfd.a $(LDLIBS)
# RESP pub/sub against Redis with one client - see bench/rpsbench.c and
# bench/rpscmp.sh (which builds its own copy on the rig host)
rpsbench: bench/rpsbench.c
$(CC) $(CFLAGS) -o $@ bench/rpsbench.c -lpthread
keysnative: bench/keysnative.c lib/perfd.h libperfd.a
$(CC) $(CFLAGS) -o $@ bench/keysnative.c libperfd.a $(LDLIBS)
insbench: bench/insbench.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ bench/insbench.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
selftest: test/selftest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/selftest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# Same storm with the bucket locks compiled out - MUST fail (proves the
# storm detects what the locks prevent; see src/compat/locking.h)
selftest_broken: test/selftest.c src/compat/compat.c src/core/pcache_mem.c \
src/core/pcache_htable.c src/core/pcache_arena.c src/core/pcache_opool.c
$(CC) $(CFLAGS) $(CORE_WNO) -DPC_COMPAT_BROKEN_LOCKS -o $@ $^ $(LDLIBS)
# The whole suite under ASan+UBSan, same spelling locally and in CI. detect_leaks=0: per-thread
# scratch and the obs registries live for the process by design; halt_on_error makes UBSan loud.
check-asan:
$(MAKE) clean
ASAN_OPTIONS=detect_leaks=0$${LD_PRELOAD:+:verify_asan_link_order=0} \
UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 \
$(MAKE) SAN="-fsanitize=address,undefined -fno-omit-frame-pointer -DPCACHE_ARENA_DEBUG" \
check
# One suite group under ASan+UBSan - the CI's per-group asan jobs (same
# flags as check-asan, which runs every group)
check-asan-g-%:
$(MAKE) clean
ASAN_OPTIONS=detect_leaks=0$${LD_PRELOAD:+:verify_asan_link_order=0} \
UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 \
$(MAKE) SAN="-fsanitize=address,undefined -fno-omit-frame-pointer -DPCACHE_ARENA_DEBUG" \
check-g-$*
# scan a sanitizer log (LOG=) for findings, EXCLUDING the broken-locks range, which always holds
# some by design; exit 1 if anything real is found, so it can gate.
check-asan-findings:
@test -n "$(LOG)" || { echo "usage: make check-asan-findings LOG=<file>"; exit 2; }
@awk '/^--- broken-locks build/{skip=1} /^--- end broken-locks/{skip=0; next} \
!skip && /runtime error:|ERROR: AddressSanitizer/{print; n++} \
END{if (n) {printf "%d sanitizer finding(s) OUTSIDE the broken-locks control\n", n; exit 1} \
else print "no sanitizer findings outside the broken-locks control"}' "$(LOG)"
# The fault suites, out of `check` (each waits minutes on liveness windows): fault1/2 drive the
# container fleet (root), fault3/4 loopback daemons; one that cannot run SKIPs, a failure in CI.
check-fault:
@for g in fault1 fault2 fault3 fault4; do $(MAKE) --no-print-directory -j1 check-g-$$g || exit 1; done
check-g-fault1: perfcached perfcli
sh test/partitiontest.sh
sh test/splitbraintest.sh
sh test/churntest.sh
check-g-fault2: perfcached perfcli
sh test/reshardtest.sh
sh test/stepdowntest.sh
sh test/dualclaimtest.sh
# The FAST gate: every unit binary plus the suites that finish in seconds - what a branch push
# must pass; `check` in full rides tag pushes.
check-fast: pagedump $(DASH_BIN) $(DASH_TEST) selftest selftest_broken memprobe noisetest noiseboundtest wipetest perfcached pubsubcli udppushcli \
perfcli pcbench clmaptest cltermtest clsynctest clhisttest \
clplacetest clseltest clpeerstest clpendtest clloctest clretaintest clacktest clackftest pcaddrtest uprespctest respouttest respcltest resppubsubtest respkvtest mgetaggtest respjsontest respscripttest respsrvtest respscantest pcglobtest upstatstest upconntest clrecontest httpdoortest respdoortest enumwalktest noisechantest clepochtest clfoundtest cladmittest clddltest clconntest perfdkindtest cfgkvtest cfgchecktest doorlivetest listenfdtest cfgsigtest autosizetest hostmontest hostlinktest crc32ctest walscantest upgverifytest clanetest logrltest clmeshtest statsresettest clboottest clpushtest clwiretest clreplaytest clrpttest clbulktest clmigtest clfwdtest clinittest clrestest clmembtest clunktest clsendtest clfleettest clworktest clpstest clspreadtest clpulltest clholdtest clcoltest clplattest natbench slottest jwtest ptreetest hashrectest walringtest rpcqtest clprobetest nodetest asyncbintest routedpairtest movedhinttest hinttest workerbaltest respreadtest frozentest quietlinktest asyncstatetest libperfd.a thrtabtest promlabeltest obstest upjsontest perfdlinktest apooltest perfdurltest perfdexectest cliupgtest dumpreadytest dumpchunktest loadrefusetest \
clustersim psrelaytest psindextest psqueuetest psinteresttest psudptest rpsbench legmetatest legwalkremovetest htfuzztest cellpoisontest chainhinttest clordertest draincarrytest chainwalktest wintest scanremovetest histtest capracetest verstamptest arenadbgtest syncfailshim.so slowlistenshim.so fopenmapshim.so allocshim.so liballoc threadfreeze clapplytest evactest arenacaptest addexptest respmaptest
./clustersim 500
./clapplytest
./respmaptest
./evactest
./arenacaptest
./addexptest
./slottest
./legmetatest
./legwalkremovetest
./htfuzztest
./cellpoisontest
./chainhinttest
./clordertest
./draincarrytest
./chainwalktest
./wintest
./scanremovetest
./histtest
./capracetest
./verstamptest
./arenadbgtest
./psrelaytest
./psindextest
./psqueuetest
./psinteresttest
./psudptest
./jwtest
./ptreetest
./hashrectest
./walringtest
./rpcqtest
./apooltest
./nodetest
./clprobetest
./thrtabtest
./promlabeltest
./obstest
./upjsontest
sh test/readmetest.sh
# cluster.c, upstream.c and verbs.c within their line budgets
sh test/sizeratchet.sh
sh test/readytest.sh ./perfcached ./slowlistenshim.so
sh test/cleardoortest.sh ./perfcached ./perfcli ./fopenmapshim.so
sh test/standalonetest.sh ./perfcached ./noisetest
sh test/maxclientstest.sh ./perfcached
# a slow consumer's close says so (it read "peer closed")
sh test/slowreadtest.sh ./perfcached
# busy_poll_us - the switch, the per-worker check, the refusal
sh test/busypolltest.sh ./perfcached
# CPU, disk, host memory and arena alarms; process.cpus
sh test/hostalerttest.sh ./perfcached
sh test/memguardtest.sh ./perfcached
sh test/nativerefusetest.sh ./perfcached
sh test/hsparktest.sh ./perfcached ./noisetest
# libperfd seals once per flush - the server opens far fewer records than requests
sh test/sealbatchtest.sh ./perfcached ./natbench
# authenticated plaintext by default, Noise where asked or required
sh test/plainauthtest.sh ./perfcached ./perfcli ./natbench
sh test/idlebuftest.sh ./perfcached
sh test/sweepwalktest.sh ./perfcached
sh test/pubsubtest.sh ./perfcached ./pubsubcli
sh test/pushbatchtest.sh ./perfcached
sh test/wiredraintest.sh ./perfcached
sh test/expireleaktest.sh ./perfcached
sh test/scanresizetest.sh ./perfcached
sh test/resizedeltest.sh ./perfcached
sh test/refusedlogtest.sh ./perfcached
sh test/prefetchtest.sh ./perfcached
sh test/pubsubpressuretest.sh ./perfcached ./rpsbench
sh test/psnotifytest.sh ./perfcached
sh test/pubsubrelaytest.sh ./perfcached
sh test/jdeltest.sh ./perfcached
sh test/xsstest.sh ./perfcached ./perfcached-dashboard
sh test/deltombtest.sh ./perfcached
sh test/routedpairtest.sh ./perfcached ./routedpairtest
sh test/expiretest.sh ./perfcached
sh test/delprobetest.sh ./perfcached
sh test/plaintextdoortest.sh ./perfcached ./perfcli
sh test/movedhinttest.sh ./perfcached ./movedhinttest
sh test/workerbaltest.sh ./perfcached ./workerbaltest
sh test/respreadtest.sh ./perfcached ./respreadtest ./syncfailshim.so ./threadfreeze
sh test/frozentest.sh ./perfcached ./frozentest
sh test/quietlinktest.sh ./perfcached ./quietlinktest
sh test/asyncstatetest.sh ./perfcached ./asyncstatetest
sh test/upclustertest.sh ./perfcached
sh test/tlsdoortest.sh ./perfcached
sh test/uptlstest.sh ./perfcached
sh test/respmovedtest.sh ./perfcached
sh test/syncfailtest.sh ./perfcached ./syncfailshim.so
sh test/stalltest.sh ./perfcached ./threadfreeze ./perfcli
sh test/stallmastertest.sh ./perfcached ./threadfreeze ./perfcli
sh test/applythreadstest.sh ./perfcached
sh test/pullordertest.sh ./perfcached
sh test/relayrxtest.sh ./perfcached
sh test/replplanetest.sh ./perfcached
sh test/waltest.sh ./perfcached
sh test/relayinteresttest.sh ./perfcached
sh test/udppushtest.sh ./perfcached ./udppushcli
sh test/httpidletest.sh ./perfcached
sh test/httpsweeptest.sh ./perfcached
sh test/metricsresettest.sh ./perfcached
sh test/statsschedtest.sh ./perfcached
sh test/doorwraptest.sh ./perfcached
sh test/keyspacetest.sh ./perfcached
sh test/cmdstatstest.sh ./perfcached
sh test/hotkeytest.sh ./perfcached
sh test/reloadtest.sh ./perfcached ./perfcli
sh test/clientstest.sh ./perfcached
./clmaptest
./cltermtest
./clsynctest
./clhisttest
./clplacetest
./clseltest
./clpeerstest
./clpendtest
./clloctest
./clretaintest
./clacktest
./clackftest
./pcaddrtest
./uprespctest
./respouttest
./respcltest
./resppubsubtest
./respkvtest
./mgetaggtest
./respjsontest
./respscripttest
./respsrvtest
./respscantest
./pcglobtest
./upstatstest
./upconntest
./clrecontest
./httpdoortest
./respdoortest
./enumwalktest
./noisechantest
./clepochtest
./clfoundtest
./cladmittest
./clddltest
./clconntest
./perfdkindtest
./perfdlinktest
./perfdurltest
./perfdexectest
./cliupgtest
$(if $(DASH_TEST),./$(DASH_TEST))
./dumpreadytest
./dumpchunktest
./loadrefusetest
./cfgkvtest
./cfgchecktest
./doorlivetest
./listenfdtest
./cfgsigtest
./autosizetest
./hostmontest
./hostlinktest
./crc32ctest
./walscantest
./upgverifytest
./clanetest
./logrltest
./clmeshtest
./statsresettest
./clrestest
./clmembtest
./clunktest
./clsendtest
./clfleettest
./clworktest
./clpstest
./clspreadtest
./clpulltest
./clholdtest
./clcoltest
./clplattest
./clboottest
./clpushtest
./clwiretest
./clreplaytest
./clrpttest
./clbulktest
./clmigtest
./clfwdtest
./clinittest
./memprobe
./selftest
./noisetest
./noiseboundtest
./wipetest
sh test/configtest.sh ./perfcached
sh test/stagetest.sh ./perfcached ./perfcli ./syncfailshim.so
sh test/daemontest.sh ./perfcached
sh test/prototest.sh ./perfcached
sh test/bintest.sh ./perfcached
sh test/verbtest.sh ./perfcached
sh test/httptest.sh ./perfcached
sh test/fleetcolstest.sh ./perfcached
sh test/unknowntest.sh ./perfcached
sh test/pintest.sh ./perfcached
sh test/slowredacttest.sh ./perfcached
sh test/unknownfleettest.sh ./perfcached
sh test/mitboundtest.sh libperfd.a
sh test/asyncbin.sh ./perfcached ./asyncbintest
# this build's locks are DELIBERATELY BROKEN and it must fail: its sanitizer findings are the point,
# and the markers let `make check-asan-findings` exclude them.
@echo "--- broken-locks build (must fail) ---"
@if ./selftest_broken; then \
echo "check-fast FAILED: the broken-locks storm PASSED"; exit 1; \
else echo "broken-locks storm failed as it must"; fi
@echo "--- end broken-locks (its sanitizer findings are expected) ---"
@echo "FAST CHECKS PASS (cluster/storage suites ride the full check)"
# statlint on its own, for the edit-test loop; it is in `check` as well - a suite only this
# target runs is a suite CI never runs.
statlint:
sh test/statlint.sh
spreadroutetest: perfcached failovertest
sh test/spreadroutetest.sh ./perfcached ./failovertest
restarttest: perfcached
sh test/restarttest.sh ./perfcached
spreadtest: perfcached
sh test/spreadtest.sh ./perfcached
sh test/spreadcoldtest.sh ./perfcached
fastgate: perfcached
sh test/fastgate.sh ./perfcached
# the coverage sketch counts DISTINCT served keys; epochs are driven through compat_ticks_offset,
# so it asserts real cardinalities without sleeping for a window.
reachtest: test/reachtest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/reachtest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# client-only totals and reach are a slot RANGE; this proves the
# arithmetic, the reset, and that an unregistered range reads as before.
origintest: test/origintest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/origintest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a record in the overflow leg walks out with the same version, flags and write tick as one in a
# bucket; the arena is compiled WITH its debug invariants, into this binary only
arenadbgtest: test/arenadbgtest.c src/core/pcache_arena.c src/core/pcache_mem.o \
src/core/pcache_htable.o src/core/pcache_opool.o src/compat/compat.o
$(CC) $(CFLAGS) $(CORE_WNO) -DPCACHE_ARENA_DEBUG -o $@ $^ $(LDLIBS)
capracetest: test/capracetest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/capracetest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# includes the table itself, to hold a bucket lock - so it links
# every core object BUT the table
verstamptest: test/verstamptest.c src/core/pcache_htable.c src/core/pcache_htable.h $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) $(CORE_WNO) -o $@ test/verstamptest.c \
$(filter-out src/core/pcache_htable.o,$(CORE_OBJS)) \
src/compat/compat.o $(LDLIBS)
legmetatest: test/legmetatest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/legmetatest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a walk whose callback removes each record still hands over
# every record - the shape of a proxy migration.
legwalkremovetest: test/legwalkremovetest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/legwalkremovetest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# ASan's view of the arena's cells, read back from its shadow (an
# ASan build checks; a plain one says it skipped)
cellpoisontest: test/cellpoisontest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/cellpoisontest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# the shadow-model fuzzer - the same hooked table, so the maintenance
# thread's work runs inside a read's window too
htfuzztest: test/htfuzztest.c src/core/pcache_htable.c src/core/*.h \
src/core/pcache_mem.o src/core/pcache_arena.o src/core/pcache_opool.o \
src/compat/compat.o
$(CC) $(CFLAGS) $(CORE_WNO) -DPCACHE_TEST_HOOKS -o $@ test/htfuzztest.c \
src/core/pcache_htable.c src/core/pcache_mem.o \
src/core/pcache_arena.o src/core/pcache_opool.o src/compat/compat.o \
$(LDLIBS)
# a walk hands over a chain exactly once while removes move its tail
chainwalktest: test/chainwalktest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/chainwalktest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a set and a delete of one key on two receive threads
draincarrytest: test/draincarrytest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/draincarrytest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS) -lpthread
clordertest: test/clordertest.c src/clorder.o $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/clordertest.c src/clorder.o $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a chained record is reaped when due
chainhinttest: test/chainhinttest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/chainhinttest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# the five-minute counter windows, on an injected clock
wintest: test/wintest.c src/winctr.o src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/wintest.c src/winctr.o src/compat/compat.o $(LDLIBS)
# the cursored scan (the drop's walk) removes as it goes, one pass.
scanremovetest: test/scanremovetest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/scanremovetest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# the latency histogram's resolution - a percentile must estimate
# the value, not name a power of two above it.
histtest: test/histtest.c src/pcaddr.o src/obs.o src/json.o src/ptree.o src/clunk.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/histtest.c src/pcaddr.o src/obs.o src/json.o src/ptree.o src/clunk.o \
src/compat/compat.o $(LDLIBS)
# what the command rows and the query log keep of a client's bytes
obstest: test/obstest.c src/pcaddr.o src/obs.o src/json.o src/ptree.o src/clunk.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/obstest.c src/pcaddr.o src/obs.o src/json.o src/ptree.o src/clunk.o \
src/compat/compat.o $(LDLIBS)
# the index geometry - a segment is one slot and a sixteenth - and that what index_bytes
# quotes is what regions_bytes moves by.
indextest: test/indextest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/indextest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# the quiescent-state primitive a table retirement waits on.
quiesctest: test/quiesctest.c src/quiesce.o
$(CC) $(CFLAGS) -Isrc -o $@ test/quiesctest.c src/quiesce.o -lpthread
# the RESP door's DB-index map at runtime, without a daemon
respmaptest: test/respmaptest.c src/respmap.o src/quiesce.o src/compat/compat.o src/respmap.h
$(CC) $(CFLAGS) -Isrc -o $@ test/respmaptest.c src/respmap.o src/quiesce.o src/compat/compat.o -lpthread
# a retired table's slots come back - taken before the frontier
# moves, punched out past the cool-off - and RSS says so.
regiontest: test/regiontest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/regiontest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a carve while a tail punch is in flight lands outside it
tailflighttest: test/tailflighttest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/tailflighttest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# the hash record's pure functions
hashrectest: test/hashrectest.c src/hashrec.o
$(CC) $(CFLAGS) -Isrc -o $@ test/hashrectest.c src/hashrec.o -lm
# HGET and HSET ops/s (and the daemon's CPU per op) on a ~50 KB and a ~500 B hash; a bench,
# not a gate, so it is not under make check.
hashbench: perfcached
sh test/hashbench.sh ./perfcached
# the native door's value codec
ptreetest: test/ptreetest.c src/ptree.o src/json.o src/compat/compat.o
$(CC) $(CFLAGS) -Isrc -o $@ test/ptreetest.c src/ptree.o src/json.o \
src/compat/compat.o $(LDLIBS)
# the survivors of a mass expiry, moved out of the chunks they pin
evactest: test/evactest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/evactest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# a punched slot read as used by the capacity scan
arenacaptest: test/arenacaptest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/arenacaptest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
# INCR and EXPIRE on a record past its deadline, not swept yet
addexptest: test/addexptest.c $(CORE_OBJS) src/compat/compat.o
$(CC) $(CFLAGS) -o $@ test/addexptest.c $(CORE_OBJS) \
src/compat/compat.o $(LDLIBS)
check-wired:
@for t in test/*.sh; do grep -q "sh $$t" Makefile || { echo "check: $$t is not run by make check - wire it in or remove it"; exit 1; }; done
# The binaries every suite group needs - check and each group build them.
CHECK_BINS = $(DASH_BIN) $(DASH_TEST) pagedump rollload selftest selftest_broken memprobe noisetest noiseboundtest libtest-so abicaller \
wipetest perfcached perfcli perfdump perfload pcbench libtest execcmp failovertest \
routedpairtest movedhinttest hinttest workerbaltest respreadtest privmovetest frozentest quietlinktest asyncstatetest mgetextest wedgetest asynctest asyncbintest clmaptest \
cltermtest clsynctest clhisttest clplacetest clseltest clpeerstest \
clpendtest clloctest clretaintest clacktest clackftest pcaddrtest uprespctest respouttest respcltest resppubsubtest respkvtest mgetaggtest respjsontest respscripttest respsrvtest respscantest pcglobtest upstatstest upconntest clrecontest httpdoortest respdoortest enumwalktest noisechantest clepochtest clfoundtest cladmittest clddltest clconntest perfdkindtest perfdlinktest perfdurltest perfdexectest cliupgtest dumpreadytest dumpchunktest loadrefusetest cfgkvtest cfgchecktest doorlivetest listenfdtest cfgsigtest autosizetest hostmontest hostlinktest crc32ctest walscantest upgverifytest clanetest logrltest clmeshtest statsresettest clboottest clpushtest clwiretest clreplaytest clrpttest \
clbulktest clmigtest clfwdtest clinittest clrestest clmembtest clunktest \
clsendtest clfleettest clworktest clpstest clspreadtest clpulltest clholdtest \
clcoltest clplattest natbench slottest jwtest ptreetest hashrectest walringtest rpcqtest apooltest apoollivetest nodetest clprobetest thrtabtest promlabeltest obstest clustersim upjsontest \