1*722c1963SRaphael Moreira ZinslyTest the nx-gzip function: 2*722c1963SRaphael Moreira Zinsly========================= 3*722c1963SRaphael Moreira Zinsly 4*722c1963SRaphael Moreira ZinslyVerify that following device exists: 5*722c1963SRaphael Moreira Zinsly /dev/crypto/nx-gzip 6*722c1963SRaphael Moreira ZinslyIf you get a permission error run as sudo or set the device permissions: 7*722c1963SRaphael Moreira Zinsly sudo chmod go+rw /dev/crypto/nx-gzip 8*722c1963SRaphael Moreira ZinslyHowever, chmod may not survive across boots. You may create a udev file such 9*722c1963SRaphael Moreira Zinslyas: 10*722c1963SRaphael Moreira Zinsly /etc/udev/rules.d/99-nx-gzip.rules 11*722c1963SRaphael Moreira Zinsly 12*722c1963SRaphael Moreira Zinsly 13*722c1963SRaphael Moreira ZinslyTo manually build and run: 14*722c1963SRaphael Moreira Zinsly$ gcc -O3 -I./include -o gzfht_test gzfht_test.c gzip_vas.c 15*722c1963SRaphael Moreira Zinsly$ gcc -O3 -I./include -o gunz_test gunz_test.c gzip_vas.c 16*722c1963SRaphael Moreira Zinsly 17*722c1963SRaphael Moreira Zinsly 18*722c1963SRaphael Moreira ZinslyCompress any file using Fixed Huffman mode. Output will have a .nx.gz suffix: 19*722c1963SRaphael Moreira Zinsly$ ./gzfht_test gzip_vas.c 20*722c1963SRaphael Moreira Zinslyfile gzip_vas.c read, 6413 bytes 21*722c1963SRaphael Moreira Zinslycompressed 6413 to 3124 bytes total, crc32 checksum = abd15e8a 22*722c1963SRaphael Moreira Zinsly 23*722c1963SRaphael Moreira Zinsly 24*722c1963SRaphael Moreira ZinslyUncompress the previous output. Output will have a .nx.gunzip suffix: 25*722c1963SRaphael Moreira Zinsly./gunz_test gzip_vas.c.nx.gz 26*722c1963SRaphael Moreira ZinslygzHeader FLG 0 27*722c1963SRaphael Moreira Zinsly00 00 00 00 04 03 28*722c1963SRaphael Moreira ZinslygzHeader MTIME, XFL, OS ignored 29*722c1963SRaphael Moreira Zinslycomputed checksum abd15e8a isize 0000190d 30*722c1963SRaphael Moreira Zinslystored checksum abd15e8a isize 0000190d 31*722c1963SRaphael Moreira Zinslydecomp is complete: fclose 32*722c1963SRaphael Moreira Zinsly 33*722c1963SRaphael Moreira Zinsly 34*722c1963SRaphael Moreira ZinslyCompare two files: 35*722c1963SRaphael Moreira Zinsly$ sha1sum gzip_vas.c.nx.gz.nx.gunzip gzip_vas.c 36*722c1963SRaphael Moreira Zinslybf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6 gzip_vas.c.nx.gz.nx.gunzip 37*722c1963SRaphael Moreira Zinslybf43e3c0c3651f5f22b6f9784cd9b1eeab4120b6 gzip_vas.c 38*722c1963SRaphael Moreira Zinsly 39*722c1963SRaphael Moreira Zinsly 40*722c1963SRaphael Moreira ZinslyNote that the code here are intended for testing the nx-gzip hardware function. 41*722c1963SRaphael Moreira ZinslyThey are not intended for demonstrating performance or compression ratio. 42*722c1963SRaphael Moreira ZinslyBy being simplistic these selftests expect to allocate the entire set of source 43*722c1963SRaphael Moreira Zinslyand target pages in the memory so it needs enough memory to work. 44*722c1963SRaphael Moreira ZinslyFor more information and source code consider using: 45*722c1963SRaphael Moreira Zinslyhttps://github.com/libnxz/power-gzip 46