mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
update for smoke testing
This commit is contained in:
parent
2e5f269650
commit
99d9f9e624
|
@ -23,7 +23,10 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
from lib.core.common import dataToStdout
|
||||||
|
from lib.core.common import getConsoleWidth
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.data import paths
|
from lib.core.data import paths
|
||||||
|
@ -34,6 +37,12 @@ def smokeTest():
|
||||||
"""
|
"""
|
||||||
import doctest
|
import doctest
|
||||||
retVal = True
|
retVal = True
|
||||||
|
count, length = 0, 0
|
||||||
|
|
||||||
|
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
|
||||||
|
for file in files:
|
||||||
|
length += 1
|
||||||
|
|
||||||
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
|
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
|
||||||
for file in files:
|
for file in files:
|
||||||
if os.path.splitext(file)[1].lower() == '.py' and file != '__init__.py':
|
if os.path.splitext(file)[1].lower() == '.py' and file != '__init__.py':
|
||||||
|
@ -45,7 +54,8 @@ def smokeTest():
|
||||||
module = sys.modules[path]
|
module = sys.modules[path]
|
||||||
except Exception, msg:
|
except Exception, msg:
|
||||||
retVal = False
|
retVal = False
|
||||||
errMsg = "smoke test failed at importing module '%s' (%s):\n%s\n" % (path, os.path.join(paths.SQLMAP_ROOT_PATH, file), msg)
|
dataToStdout("\r")
|
||||||
|
errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(paths.SQLMAP_ROOT_PATH, file), msg)
|
||||||
logger.error(errMsg)
|
logger.error(errMsg)
|
||||||
else:
|
else:
|
||||||
# Run doc tests
|
# Run doc tests
|
||||||
|
@ -54,13 +64,16 @@ def smokeTest():
|
||||||
if failure_count > 0:
|
if failure_count > 0:
|
||||||
retVal = False
|
retVal = False
|
||||||
|
|
||||||
infoMsg = "smoke test "
|
count += 1
|
||||||
|
status = '%d/%d (%d%s)' % (count, length, round(100.0*count/length), '%')
|
||||||
|
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
|
||||||
|
|
||||||
|
dataToStdout("\r%s\r" % (" "*(getConsoleWidth()-1)))
|
||||||
if retVal:
|
if retVal:
|
||||||
infoMsg += "PASSED"
|
logger.info("smoke test result: passed")
|
||||||
logger.info(infoMsg)
|
|
||||||
else:
|
else:
|
||||||
infoMsg += "FAILED"
|
logger.info("smoke test result: failed")
|
||||||
logger.error(infoMsg)
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def liveTest():
|
def liveTest():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user