2023-03-30 08:46:31 -05:00
|
|
|
# ignore-cross-compile
|
2022-08-22 19:00:00 -05:00
|
|
|
include ../tools.mk
|
2017-12-19 06:44:18 -06:00
|
|
|
|
|
|
|
# Test expected libtest's JSON output
|
|
|
|
|
2019-07-11 18:56:43 -05:00
|
|
|
OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json
|
|
|
|
OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json
|
2017-12-19 06:44:18 -06:00
|
|
|
|
2022-03-11 06:30:21 -06:00
|
|
|
all: f.rs validate_json.py output-default.json output-stdout-success.json
|
2017-12-19 06:44:18 -06:00
|
|
|
$(RUSTC) --test f.rs
|
2019-07-11 18:56:43 -05:00
|
|
|
RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true
|
|
|
|
RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true
|
2017-12-19 06:44:18 -06:00
|
|
|
|
2019-07-11 18:56:43 -05:00
|
|
|
cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py
|
|
|
|
cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py
|
2017-12-19 06:44:18 -06:00
|
|
|
|
2020-11-26 14:15:15 -06:00
|
|
|
# Normalize the actual output and compare to expected output file
|
2020-11-28 03:23:36 -06:00
|
|
|
cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json -
|
|
|
|
cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json -
|