From 2343821b8462e419bbf3fa5b99ce30bff68b96a9 Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Tue, 31 Jan 2023 17:52:15 +0100 Subject: [PATCH] Added new endianness test --- test/Makefile | 23 ++++++++++++++++++++++- test/bigendian.h5 | Bin 0 -> 22048 bytes 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/bigendian.h5 diff --git a/test/Makefile b/test/Makefile index 527f725..d1bfae4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -408,6 +408,27 @@ test-endian: plugin test_zfp_le.h5 test_zfp_be.h5 fi; \ printf " [$(OK_COLOR)PASSED$(NO_COLOR)] \n" +# Test dumping a file generated on a big endian machine +# The file was generated with: +# yes 12345 | head -n 5000 | h5import /dev/stdin -dims 5000 -type TEXTIN -size 32 -o unpacked.h5 +# h5repack -f UD=32013,0,4,1,0,0,1074921472 unpacked.h5 bigendian.h5 +test-endian1: plugin bigendian.h5 + @echo " "; \ + padlimit=80; \ + padlength=80; \ + pad=$$(printf '%*s' "$${padlimit}"); \ + pad=$${pad// /.}; \ + x="h5dump bigendian.h5"; \ + printf "$$x"; \ + printf ' %*.*s' 0 $$(($${padlength} - $${#x} )) "$$pad"; \ + env LD_LIBRARY_PATH=$(HDF5_LIB):$(LD_LIBRARY_PATH) HDF5_PLUGIN_PATH=$(H5Z_ZFP_PLUGIN) $(HDF5_BIN)/$$x | grep -q '12345, 12345, 12345, 12345,' ; \ + if [[ $$? -ne 0 ]]; then \ + printf " [$(ERROR_COLOR)FAILED$(NO_COLOR)]\n"; \ + touch check-failed; \ + exit 0; \ + fi; \ + printf " [$(OK_COLOR)PASSED$(NO_COLOR)] \n" + # Test the filter as a library rather than as a plugin test-lib-rate: test_write_lib test_read_lib @failed=0; \ @@ -697,7 +718,7 @@ PLUGIN_CHECK = test-rate test-accuracy test-precision test-h5repack ifneq ($(ZFP_HAS_REVERSIBLE),) PLUGIN_CHECK += test-reversible endif -PLUGIN_CHECK += test-endian +PLUGIN_CHECK += test-endian test-endian1 CHECK = $(LIB_CHECK) $(PLUGIN_CHECK) ifneq ($(FC),) diff --git a/test/bigendian.h5 b/test/bigendian.h5 new file mode 100644 index 0000000000000000000000000000000000000000..2f12c1de63ca430463577706d55cbcc94b218869 GIT binary patch literal 22048 zcmeIxu};G<5P;!xQjn>HRA51!GBRdmf=W%*si0C-9a|NifIa|Yc@rLmSKw*d*mox( zHpGyD-%)+e*>RfF=lAJ&a^4^ICAAo(Cxbln?qIE2YR2z