aboutsummaryrefslogtreecommitdiffstats
path: root/mutator.sh
blob: f5c503857ea00fa6a918786f4fdd575786841854 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash

#the UI for mutator. it's supposed to mimic the normal 'nix argument passing.
#the arguments' positions are not important. you also get log ans short options.

#default args
INPUT="./covtest/testFuncs1.c"
OUTPUT="./mutant.c"
COMMAND="all"

while [[ $# -gt 0 ]]
do
	passarg="$1"

	case $passarg in
		-c|--command)
		COMMAND="$2"
		shift
		;;
		-h|--help)
		COMMAND="$2"
		echo "Currently there is no help for this."
		break
		;;
		-v|--version)
		echo "Version 1.0.0"
		break
		;;
		-i|--input|-input)
		INPUT="$2"
		shift
		;;
		-o|--output|-output)
		OUTPUT="$2"
		shift
		;;
		*)
		#not a valid argument
		echo  "$1 $2 is not a valid argument..."
		break
		;;
	esac
	shift
done

if [[ "$COMMAND" == clean ]]; then
	echo "Running make clean..."
	echo "Killing all mutants..."
	"make" clean
	rm "$OUTPUT"
elif [[ "$COMMAND" == build-all ]]; then
	echo "Building all executables..."
	"make" all
elif [[ "$COMMAND" == run ]];then
	echo "Running executables on target file..."
	"./mutator" "$INPUT" -- > "$OUTPUT"
elif [[ "$COMMAND" == "default" ]]; then
	echo "Building all target executables..."
	"make" all
	echo "Running all exetubales on target input..."
	"./mutator" "$INPUT" -- > "$OUTPUT"
else 
	echo "$COMMAND is not a valid command..."
fi