From 67d3010a7974b5b255d8a61211a3dcce36ed6410 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Sat, 23 Nov 2019 07:52:47 -0600 Subject: [PATCH] Add fixture update helper (#1551) * Add makefile target to update sysfs fixtures. * Use similar style for fixtures from procfs. * Re-pack fixtures ttar file. Signed-off-by: Ben Kochie --- Makefile | 12 ++++++++---- collector/fixtures/sys.ttar | 16 ++++------------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 31eae06b..2e1f04ff 100644 --- a/Makefile +++ b/Makefile @@ -91,12 +91,16 @@ test-32bit: collector/fixtures/sys/.unpacked skip-test-32bit: @echo ">> SKIP running tests in 32-bit mode: not supported on $(GOHOSTOS)/$(GOHOSTARCH)" -collector/fixtures/sys/.unpacked: collector/fixtures/sys.ttar - @echo ">> extracting sysfs fixtures" - if [ -d collector/fixtures/sys ] ; then rm -r collector/fixtures/sys ; fi - ./ttar -C collector/fixtures -x -f collector/fixtures/sys.ttar +%/.unpacked: %.ttar + @echo ">> extracting fixtures" + if [ -d $(dir $@) ] ; then rm -r $(dir $@) ; fi + ./ttar -C $(dir $*) -x -f $*.ttar touch $@ +update_fixtures: + rm -vf collector/fixtures/sys/.unpacked + ./ttar -C collector/fixtures -c -f collector/fixtures/sys.ttar sys + .PHONY: test-e2e test-e2e: build collector/fixtures/sys/.unpacked @echo ">> running end-to-end tests" diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index 27aa0a79..3704b332 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -298,11 +298,6 @@ Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_discards -Lines: 1 -0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_errors Lines: 1 0 @@ -1278,15 +1273,16 @@ Path: sys/class/power_supply/BAT0/voltage_now Lines: 1 11660000 Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/class/thermal Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/thermal/thermal_zone0 -SymlinkTo: ../../devices/virtual/thermal/thermal_zone0 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/class/thermal/cooling_device0 SymlinkTo: ../../devices/virtual/thermal/cooling_device0 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/thermal/thermal_zone0 +SymlinkTo: ../../devices/virtual/thermal/thermal_zone0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/devices Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3200,7 +3196,3 @@ Lines: 1 20 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/.unpacked -Lines: 0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -