Back to home page

OSCL-LXR

 
 

    


0001 Test the nx-gzip function:
0002 =========================
0003 
0004 Verify that following device exists:
0005   /dev/crypto/nx-gzip
0006 If you get a permission error run as sudo or set the device permissions:
0007    sudo chmod go+rw /dev/crypto/nx-gzip
0008 However, chmod may not survive across boots. You may create a udev file such
0009 as:
0010    /etc/udev/rules.d/99-nx-gzip.rules
0011 
0012 
0013 To manually build and run:
0014 $ gcc -O3 -I./include -o gzfht_test gzfht_test.c gzip_vas.c
0015 $ gcc -O3 -I./include -o gunz_test gunz_test.c gzip_vas.c
0016 
0017 
0018 Compress any file using Fixed Huffman mode. Output will have a .nx.gz suffix:
0019 $ ./gzfht_test gzip_vas.c
0020 file gzip_vas.c read, 6413 bytes
0021 compressed 6413 to 3124 bytes total, crc32 checksum = abd15e8a
0022 
0023 
0024 Uncompress the previous output. Output will have a .nx.gunzip suffix:
0025 ./gunz_test gzip_vas.c.nx.gz
0026 gzHeader FLG 0
0027 00 00 00 00 04 03
0028 gzHeader MTIME, XFL, OS ignored
0029 computed checksum abd15e8a isize 0000190d
0030 stored   checksum abd15e8a isize 0000190d
0031 decomp is complete: fclose
0032 
0033 
0034 Compare two files:
0035 $ sha1sum gzip_vas.c.nx.gz.nx.gunzip gzip_vas.c
0036 bf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6  gzip_vas.c.nx.gz.nx.gunzip
0037 bf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6  gzip_vas.c
0038 
0039 
0040 Note that the code here are intended for testing the nx-gzip hardware function.
0041 They are not intended for demonstrating performance or compression ratio.
0042 By being simplistic these selftests expect to allocate the entire set of source
0043 and target pages in the memory so it needs enough memory to work.
0044 For more information and source code consider using:
0045 https://github.com/libnxz/power-gzip