Skip to content

Commit

Permalink
tests: Run misc tests instead of __main__ in related modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Hogben committed Dec 6, 2018
1 parent 50d5826 commit 30f9f93
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 14 deletions.
2 changes: 2 additions & 0 deletions tests/misc/runalltestcases.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

FOR /f "tokens=*" %%G IN ('dir /B *.py') DO %%G
44 changes: 44 additions & 0 deletions tests/misc/runalltestcases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
separator='======================================================================'

export PYTHONPATH=../..:$PYTHONPATH

if [ $# -gt 0 ]
then
# Only run coverage when called by tox
RUN="coverage run --append --rcfile=../coveragerc "
else
RUN=python
fi

total=0
ok=0
failed=0
for file in `ls *.py` ; do
echo $separator
echo Executing $RUN $file
latest=$(
$RUN $file 2>&1 | {
while read line; do
echo " $line" 1>&2
latest="$line"
done
echo $latest
}
)
#echo Latest ${latest}
result=${latest:0:6}
if [ "$result" = "FAILED" ]
then
(( failed++ ))
elif [ "$result" = "OK" ]
then
(( ok++ ))
fi

(( total++ ))
done
echo $separator
echo Summary:
echo " OK $ok/$total"
echo " $failed FAILED"
18 changes: 4 additions & 14 deletions tests/runall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ python -V
echo Walking modules
$RUNLOCAL ./walkmodules.py

echo Running __main__ on some important files
$RUNLOCAL -m impacket.crypto __main__
$RUNLOCAL -m impacket.krb5.crypto __main__
$RUNLOCAL -m impacket.structure __main__
$RUNLOCAL -m impacket.dns __main__
$RUNLOCAL -m impacket.IP6_Address __main__
$RUNLOCAL -m impacket.dcerpc.v5.ndr __main__

echo Testing ImpactPacket
cd ImpactPacket
./runalltestcases.sh $COVERAGE 2>&1 1>/dev/null | tee -a $OUTPUTFILE
Expand Down Expand Up @@ -62,13 +54,11 @@ if [ -z "$NO_REMOTE" ]; then
$RUN test_nmb.py 2>&1 1>/dev/null | tee -a $OUTPUTFILE
./rundce.sh $COVERAGE 2>&1 1>/dev/null | tee -a $OUTPUTFILE
fi
cd ..

echo Testing MISC
cd misc
export PYTHONPATH=../../:$PYTHONPATH
echo test_dpapi.py
$RUN test_dpapi.py 2>&1 1>/dev/null | tee -a $OUTPUTFILE
echo Testing misc
cd ../misc
./runalltestcases.sh $COVERAGE 2>&1 1>/dev/null | tee -a $OUTPUTFILE

cd ..

if [ $COVERAGE ]
Expand Down

0 comments on commit 30f9f93

Please sign in to comment.