| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
import subprocess |
| 15 |
|
| 16 |
from rsyncfns import TOOLDIR, test_fail, test_skipped |
| 17 |
|
| 18 |
RERR_MALLOC = 22 |
| 19 |
|
| 20 |
helper = TOOLDIR / 't_hashtable_overflow' |
| 21 |
if not helper.is_file(): |
| 22 |
test_skipped("t_hashtable_overflow helper not built") |
| 23 |
|
| 24 |
proc = subprocess.run([str(helper)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| 25 |
timeout=30) |
| 26 |
rc = proc.returncode |
| 27 |
if rc == RERR_MALLOC: |
| 28 |
print("hashtable-overflow: hashtable_create rejected the oversized size " |
| 29 |
"(exited RERR_MALLOC) instead of under-allocating") |
| 30 |
elif rc < 0: |
| 31 |
test_fail(f"t_hashtable_overflow crashed (signal {-rc}): the hashtable " |
| 32 |
"size*node_size integer overflow under-allocated the table\n" |
| 33 |
+ (proc.stderr or b'').decode('utf-8', 'replace')) |
| 34 |
else: |
| 35 |
test_fail(f"t_hashtable_overflow exited {rc}, expected RERR_MALLOC ({RERR_MALLOC}): " |
| 36 |
"the oversized hashtable_create was not rejected\n" |
| 37 |
+ (proc.stderr or b'').decode('utf-8', 'replace')) |