Skip to content

Commit

Permalink
Added more testing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenney5 committed Jun 2, 2021
1 parent fd76bea commit 1cde59c
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/check12.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2019 (c) Adam McKenney - See LICENSE for details #
# Copyright 2021 (c) Adam McKenney - See LICENSE for details #
# Makes cat.out clone its self with its self 12 times then checks to see if theres a difference

if [ -f cat.out ]; then
Expand Down Expand Up @@ -29,10 +29,10 @@ if [ -f cat.out ]; then
./11.out 11.out > 12.out

echo "Checking the difference between cat.out and its 12th itteration."
echo "Just an output of '0' is a good thing:"
echo "Just an output of '0' means it passed:"
diff cat.out 12.out
echo $?
rm -v 1.out 2.out 3.out 4.out 5.out 6.out 7.out 8.out 9.out 10.out 11.out 12.out cat.out
rm 1.out 2.out 3.out 4.out 5.out 6.out 7.out 8.out 9.out 10.out 11.out 12.out
else
echo "cat.out not found"
fi
Expand Down
21 changes: 21 additions & 0 deletions scripts/full_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# This does a full test before release

echo "### Creating cat.out ###"
gcc ../src/cat.c -g -o cat.out

echo "### Checking for memory leaks ###"
echo "Type in input, then hit Ctrl-D, do this twice"
valgrind -q ./cat.out - ../src/cat.c -

echo "### Doing consistancy test ###"
./check12.sh
./unbuf.check12.sh

echo "### Doing speed test ###"
./times.sh

echo "### Cleaning up ###"
rm -v cat.out

echo "\nDone."
39 changes: 39 additions & 0 deletions scripts/unbuf.check12.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Copyright 2021 (c) Adam McKenney - See LICENSE for details #
# Makes cat.out clone its self with its self 12 times then checks to see if theres a difference

if [ -f cat.out ]; then
echo "Generating 12 cats..."
cat cat.out > 1.out
chmod +x 1.out
./1.out -u 1.out > 2.out
chmod +x 2.out
./2.out -u 2.out > 3.out
chmod +x 3.out
./3.out -u 3.out > 4.out
chmod +x 4.out
./4.out -u 4.out > 5.out
chmod +x 5.out
./5.out -u 5.out > 6.out
chmod +x 6.out
./6.out -u 6.out > 7.out
chmod +x 7.out
./7.out -u 7.out > 8.out
chmod +x 8.out
./8.out -u 8.out > 9.out
chmod +x 9.out
./9.out -u 9.out > 10.out
chmod +x 10.out
./10.out -u 10.out > 11.out
chmod +x 11.out
./11.out -u 11.out > 12.out

echo "Checking the difference between cat.out UNBUFFERED and its 12th itteration."
echo "Just an output of '0' means it passed:"
diff cat.out 12.out
echo $?
rm 1.out 2.out 3.out 4.out 5.out 6.out 7.out 8.out 9.out 10.out 11.out 12.out
else
echo "cat.out not found"
fi

0 comments on commit 1cde59c

Please sign in to comment.