summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2016-05-24 15:50:44 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2016-06-06 15:39:05 -0700
commit42b07cc9c8d2e6251d190e5ea0d13fd66cb51e6d (patch)
tree493ffc6b16278c54da28645d96a9359717625576 /test
parent0eafc0af940646ab581e47e63090c1692a3525aa (diff)
cmake: Global handler for OOM situations
Diffstat (limited to 'test')
-rwxr-xr-xtest/CMakeLists.txt5
-rw-r--r--test/exhaustion_tests.py45
2 files changed, 0 insertions, 50 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 098321b..3b23cff 100755
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -38,11 +38,6 @@ IF (PYTHONINTERP_FOUND)
"--library-dir" "${CMAKE_CURRENT_BINARY_DIR}/../src"
)
- add_test(exhaustion_tests_executable
- ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/exhaustion_tests.py"
- "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
- )
-
add_test(spectest_executable
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
)
diff --git a/test/exhaustion_tests.py b/test/exhaustion_tests.py
deleted file mode 100644
index 876bb15..0000000
--- a/test/exhaustion_tests.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import argparse
-import sys
-import os
-import tempfile
-from subprocess import *
-
-DATA = bytes("""
-Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. Ya r'luh hlirghor uaaah ah, nilgh'ri fhtagnnyth ilyaa gof'nn ilyaa nog zhro hupadgh yaor, ah hupadgh ph'zhro h'uh'e Yoggoth vulgtm uh'e hai mnahn'. Phlegeth fm'latgh lw'nafh Cthulhu kn'a nog 'bthnk ya ehye fm'latgh y-n'gha, y-r'luh 'fhalmaoth gnaiih ep hai ep nog lloig grah'n hafh'drn zhroyar, mnahn' uh'e nnnch' chtenff uln f'ooboshu orr'e k'yarnak hlirgh. H'vulgtm ng'bthnk n'ghft stell'bsna hai nnnkadishtu lloig nglui nilgh'ri ron, nagnaiih ronnyth phlegeth f'ep ooboshuor mg y-Hastur shagg, f'Chaugnar Faugn bug uaaah ehye kn'a geb orr'e lw'nafh. Ilyaa shtunggli uh'e naflhrii k'yarnak ya, nog k'yarnak wgah'n shagg nnnhlirgh, gof'nnyar r'luh Azathoth wgah'n.
-""", 'UTF-8')
-
-# CMark has a default maximum buffer growth size of 32mb,
-# which means that the total size of the buffer cannot be
-# larger than (32 + 16)mb in total, accounting for overgrowth
-MAX_FILE_SIZE = 48.0 # mb
-
-def exhaustion(prog):
- with tempfile.TemporaryFile() as tmp:
- p1 = Popen(prog.split(), stdout=tmp, stdin=PIPE)
- written, read = 0, 0
-
- for i in range(512 * 512):
- p1.stdin.write(DATA)
- written += len(DATA)
-
- p1.stdin.close()
- res = p1.wait()
- written = written / (1024.0 * 1024.0)
- read = tmp.tell() / (1024.0 * 1024.0)
-
- if res != 0:
- raise Exception("CMark did not exit properly")
- if written <= read:
- raise Exception("Output was not truncated (%fmb -> %fmb)" % (written, read))
- if read > MAX_FILE_SIZE:
- raise Exception("Output was not truncated at the expected range (%fmb)" % (read))
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser(description='Run cmark exhaustion tests')
- parser.add_argument('--program', dest='program', nargs='?', default=None,
- help='program to test')
- args = parser.parse_args(sys.argv[1:])
- exhaustion(args.program)