|
17 | 17 |
|
18 | 18 | from extra.beep.beep import beep |
19 | 19 | from lib.controller.controller import start |
| 20 | +from lib.core.common import checkIntegrity |
20 | 21 | from lib.core.common import clearConsoleLine |
21 | 22 | from lib.core.common import dataToStdout |
22 | 23 | from lib.core.common import getUnicode |
@@ -51,41 +52,44 @@ def smokeTest(): |
51 | 52 | retVal = True |
52 | 53 | count, length = 0, 0 |
53 | 54 |
|
54 | | - for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): |
55 | | - if any(_ in root for _ in ("thirdparty", "extra")): |
56 | | - continue |
57 | | - |
58 | | - for filename in files: |
59 | | - if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": |
60 | | - length += 1 |
61 | | - |
62 | | - for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): |
63 | | - if any(_ in root for _ in ("thirdparty", "extra")): |
64 | | - continue |
65 | | - |
66 | | - for filename in files: |
67 | | - if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": |
68 | | - path = os.path.join(root, os.path.splitext(filename)[0]) |
69 | | - path = path.replace(paths.SQLMAP_ROOT_PATH, '.') |
70 | | - path = path.replace(os.sep, '.').lstrip('.') |
71 | | - try: |
72 | | - __import__(path) |
73 | | - module = sys.modules[path] |
74 | | - except Exception, msg: |
75 | | - retVal = False |
76 | | - dataToStdout("\r") |
77 | | - errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), msg) |
78 | | - logger.error(errMsg) |
79 | | - else: |
80 | | - # Run doc tests |
81 | | - # Reference: http://docs.python.org/library/doctest.html |
82 | | - (failure_count, test_count) = doctest.testmod(module) |
83 | | - if failure_count > 0: |
| 55 | + if not checkIntegrity(): |
| 56 | + retVal = False |
| 57 | + else: |
| 58 | + for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): |
| 59 | + if any(_ in root for _ in ("thirdparty", "extra")): |
| 60 | + continue |
| 61 | + |
| 62 | + for filename in files: |
| 63 | + if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": |
| 64 | + length += 1 |
| 65 | + |
| 66 | + for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): |
| 67 | + if any(_ in root for _ in ("thirdparty", "extra")): |
| 68 | + continue |
| 69 | + |
| 70 | + for filename in files: |
| 71 | + if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py": |
| 72 | + path = os.path.join(root, os.path.splitext(filename)[0]) |
| 73 | + path = path.replace(paths.SQLMAP_ROOT_PATH, '.') |
| 74 | + path = path.replace(os.sep, '.').lstrip('.') |
| 75 | + try: |
| 76 | + __import__(path) |
| 77 | + module = sys.modules[path] |
| 78 | + except Exception, msg: |
84 | 79 | retVal = False |
85 | | - |
86 | | - count += 1 |
87 | | - status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) |
88 | | - dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) |
| 80 | + dataToStdout("\r") |
| 81 | + errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), msg) |
| 82 | + logger.error(errMsg) |
| 83 | + else: |
| 84 | + # Run doc tests |
| 85 | + # Reference: http://docs.python.org/library/doctest.html |
| 86 | + (failure_count, test_count) = doctest.testmod(module) |
| 87 | + if failure_count > 0: |
| 88 | + retVal = False |
| 89 | + |
| 90 | + count += 1 |
| 91 | + status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length)) |
| 92 | + dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) |
89 | 93 |
|
90 | 94 | clearConsoleLine() |
91 | 95 | if retVal: |
|
0 commit comments