File: crashtest.py

package info (click to toggle)
libusrsctp 0.9.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 6,604 kB
  • sloc: ansic: 82,365; sh: 176; makefile: 163; python: 48
file content (43 lines) | stat: -rwxr-xr-x 927 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
import glob
import subprocess
import os
import re

reportdir = "reports/"

class bcolors:
	HEADER = '\033[95m'
	OKBLUE = '\033[94m'
	OKGREEN = '\033[92m'
	WARNING = '\033[93m'
	FAIL = '\033[91m'
	ENDC = '\033[0m'
	BOLD = '\033[1m'
	UNDERLINE = '\033[4m'


print("Testing crashfiles")

FNULL = open(os.devnull, "w")
crashfiles = []
crashfiles.extend(glob.glob("*"))
pattern = re.compile("^(leak-|timeout-|crash-)\w+$")

filecounter = 1

FNULL = open(os.devnull, 'w')

for filename in crashfiles:

	if not pattern.match(filename):
		continue

	fuzzer_retval = subprocess.call(["./check-input.sh", filename, "batchmode"], stdout=FNULL, stderr=subprocess.STDOUT)
	
	if fuzzer_retval == 0:
		print(bcolors.FAIL, "[", filecounter, "]", filename,"- not reproducable", bcolors.ENDC)
	else:
		print(bcolors.OKGREEN, "[", filecounter, "]", filename, "- reproducable", bcolors.ENDC)

	filecounter = filecounter + 1