diff --git a/tests/Makefile.am b/tests/Makefile.am index 382d6a25..1cbb7523 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,7 +2,7 @@ EXTRA_DIST = fixtures/reality_openssl_hello.hex data/silero_speech.pcm data/silero_speech.txt test_net.h \ run_tests.py test_run_tests.py test_build_script.py stream_netns/topology.py stream_netns/network.py \ - stream_netns/probe.py stream_netns/run.py stream_netns/scenario.py + stream_netns/probe.py stream_netns/run.py stream_netns/scenario.py stream_netns/README.md stream_netns/test_isolation.py # Порядок по замерам Linux: быстрые проверки раньше длительных; состав зависит от прежних configure-условий. @@ -192,6 +192,7 @@ stream_netns_stream_lab_node_SOURCES = stream_netns/node.c stream_netns_stream_lab_node_LDADD = $(LIBUTUN) $(CRYPTO_LIBS) $(COMMON_LIBS) check-stream-netns: stream_netns/stream_lab_node$(EXEEXT) + python3 "$(srcdir)/stream_netns/test_isolation.py" python3 "$(srcdir)/stream_netns/run.py" --binary "$(abs_builddir)/stream_netns/stream_lab_node$(EXEEXT)" $(STREAM_NETNS_ARGS) endif diff --git a/tests/stream_netns/node.c b/tests/stream_netns/node.c index 51e95fd2..40fcd1f1 100644 --- a/tests/stream_netns/node.c +++ b/tests/stream_netns/node.c @@ -203,7 +203,17 @@ static void statistics(struct lab *lab, uint64_t id, int loads) { stream_buffer_path(local.buffer, last, sub, &path) != STREAM_OK) continue; printf("%s{\"sub\":%u,\"seq\":%" PRIu64 ",\"nodes\":[", path_separator++ ? "," : "", sub, last); for (unsigned p = 0; p < path.count; p++) printf("%s\"%" PRIu64 "\"", p ? "," : "", path.nodes[p]); - printf("]}"); + printf("]"); + const uint8_t *wire; size_t length; uint64_t actual; + if (stream_buffer_read(local.buffer, last, sub, &wire, &length, &actual) == STREAM_OK) + printf(",\"source_timestamp_ms\":%u", (unsigned)stream_read_be(wire + STREAM_BLOCK_TIMESTAMP_OFF, 2)); + struct stream_metric_snapshot metric; + if (stream_local_metrics(lab->inst, &info.descriptor, sub, now_ns() / UINT64_C(1000000), &metric) == STREAM_OK) + printf(",\"lag_ms\":%" PRIu64 ",\"source_rate\":%" PRIu64 ",\"receive_rate\":%" PRIu64 + ",\"late_blocks\":%" PRIu64 ",\"stops\":%" PRIu64 ",\"stopped\":%d", + metric.lag_ms, metric.source_rate_bytes_sec, metric.receive_rate_bytes_sec, + metric.late_blocks, metric.stops, metric.stopped); + printf("}"); } } printf("]");