Last active
May 27, 2020 14:31
-
-
Save nmoinvaz/eec4314001dfe33d80be36763a5faaf3 to your computer and use it in GitHub Desktop.
Zlib-ng switchlevels python burn test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import argparse | |
parser = argparse.ArgumentParser(description='Switchlevel burn script') | |
parser.add_argument('--bin_dir', help='Binaries directory', default='.\\Debug\\') | |
parser.add_argument('--test_file', help='Test file to compress', default='test/data/lcet10.txt') | |
args, unknown = parser.parse_known_args() | |
for y in range(0, 100000): | |
levels = '' | |
for s in range(0, random.randint(0, 9)): | |
levels += ' {0} {1}'.format(random.randint(0, 9), random.randint(0, 32 * 1024)) | |
cmd = 'switchlevels{1} < {0} > {0}.gz'.format(args.test_file, levels) | |
print(cmd) | |
os.system(args.bin_dir + cmd) | |
cmd = 'minigzip -d -c -k {0}.gz > {0}.out'.format(args.test_file) | |
print(cmd) | |
exit_code = os.system(args.bin_dir + cmd) | |
if exit_code != 0: | |
print(exit_code) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment