-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
103 lines (99 loc) · 2.47 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
default: simpsh
simpsh: simpsh.c
gcc -o simpsh -g simpsh.c
check: simpsh
@echo off ; \
folder=804608241makechecktest ; \
mkdir $${folder} ; \
cp simpsh $${folder}/simpsh ; \
cd $${folder} ; \
str="This should be printed to output." ; \
echo $${str} > in.txt ; \
empty="" ; \
echo $${empty} > out.txt ; \
echo $${empty} > err.txt ; \
remove="rm -rf 804608241makechecktest" ; \
./simpsh --rdonly=in.txt --wronly=out.txt --wronly=err.txt --command 0 1 2 cat ; \
if [ $$? -eq 0 ] ; \
then \
echo "test 1 passed." ; \
else \
echo "test 1 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdonly=dne.txt --wronly=out.txt --wronly=err.txt --command 0 1 2 cat ; \
if [ $$? -ne 0 ] ; \
then \
echo "test 2 passed." ; \
else \
echo "test 2 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdonly=in.txt --wronly=dne.txt --wronly=err.txt --command 0 1 2 cat ; \
if [ $$? -ne 0 ] ; \
then \
echo "test 3 passed." ; \
else \
echo "test 3 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdonly --wronly=out.txt --wronly=err.txt --command 0 1 2 cat ; \
if [ $$? -ne 0 ] ; \
then \
echo "test 4 passed." ; \
else \
echo "test 4 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdwr=in.txt --rdwr=out.txt --wronly=err.txt --command 0 1 2 cat ; \
if [ $$? -eq 0 ] ; \
then \
echo "test 5 passed." ; \
else \
echo "test 5 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdonly=in.txt --pipe --trunc --wronly=out.txt --wronly=err.txt --command 0 2 4 cat --command 1 3 4 cat ; \
diff in.txt out.txt ; \
if [ $$? -eq 0 ] ; \
then \
echo "test 6 passed." ; \
else \
echo "test 6 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
./simpsh --rdonly=in.txt --trunc --wronly=out.txt --trunc --wronly=err.txt --creat --wronly out2.txt --command 0 1 2 cat --abort --command 0 3 2 cat ; \
if [ ! -s out2.txt ] ; \
then \
echo "test 7 passed." ; \
else \
echo "test 7 failed." ; \
cd .. ; \
$${remove} ; \
exit 1 ; \
fi ; \
echo "ALL TESTS PASSED." ; \
cd .. ; \
$${remove}
clean:
rm -f simpsh lab1-yamatosasaki.tar.gz
dist: simpsh.c README Makefile Lab_1C_Report.pdf
mkdir lab1-yamatosasaki ; \
cp simpsh.c lab1-yamatosasaki/simpsh.c ; \
cp README lab1-yamatosasaki/README ; \
cp Makefile lab1-yamatosasaki/Makefile ; \
cp Lab_1C_Report.pdf lab1-yamatosasaki/Lab_1C_Report.pdf ; \
tar -czvf lab1-yamatosasaki.tar.gz lab1-yamatosasaki ; \
rm -r lab1-yamatosasaki