-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_all_cs.sh
More file actions
executable file
·50 lines (40 loc) · 976 Bytes
/
test_all_cs.sh
File metadata and controls
executable file
·50 lines (40 loc) · 976 Bytes
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
#!/bin/bash
PASS=0
FAIL=0
echo "Verifying all MAANG Prep C# files individually..."
echo ""
# Store the original directory
ORIG_DIR=$(pwd)
# Create a temporary dotnet project
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
dotnet new classlib -n DummyProj >/dev/null 2>&1
cd DummyProj
rm -f Class1.cs
for file in $(find "$ORIG_DIR" -name "*.cs" | sort); do
# Remove any previously copied .cs files in the dummy proj
rm -f *.cs
# Copy the current file
cp "$file" .
# Build it
dotnet build > build.log 2>&1
# Check status
if [ $? -ne 0 ]; then
echo "[FAIL] $(basename "$file") failed to compile!"
cat build.log | grep -E "error CS"
FAIL=$((FAIL+1))
else
echo "[PASS] $(basename "$file") compiled successfully."
PASS=$((PASS+1))
fi
done
# Cleanup
cd "$ORIG_DIR"
rm -rf "$TEMP_DIR"
echo ""
echo "Total Passed: $PASS"
echo "Total Failed: $FAIL"
if [ $FAIL -gt 0 ]; then
exit 1
fi
exit 0