kopia lustrzana https://github.com/jupyterhub/repo2docker
Merge pull request #161 from yuvipanda/crazy-musl
Remove symlink & just copy postBuild file insteadpull/143/head
commit
e0e335402f
|
@ -79,3 +79,22 @@ def test_memlimit_dockerfile_fail():
|
|||
512,
|
||||
256
|
||||
)
|
||||
|
||||
|
||||
def test_memlimit_same_postbuild():
|
||||
"""
|
||||
Validate that the postBuild files for dockerfile & nondockerfile are same
|
||||
|
||||
Until https://github.com/jupyter/repo2docker/issues/160 gets fixed.
|
||||
"""
|
||||
basedir = os.path.dirname(__file__)
|
||||
filepaths = [
|
||||
os.path.join(basedir, 'memlimit', t, "postBuild")
|
||||
for t in ("dockerfile", "non-dockerfile")
|
||||
]
|
||||
file_contents = []
|
||||
for fp in filepaths:
|
||||
with open(fp) as f:
|
||||
file_contents.append(f.read())
|
||||
# Make sure they're all the same
|
||||
assert len(set(file_contents)) == 1
|
||||
|
|
|
@ -4,6 +4,11 @@ Simplest program that tries to allocate a large amount of RAM.
|
|||
|
||||
malloc lies on Linux by default, so we use memset to force the
|
||||
kernel to actually give us real memory.
|
||||
|
||||
NOTE: This file has to be duplicated & present in all the following locations:
|
||||
- tests/memlimit/dockerfile/postBuild
|
||||
- tests/memlimit/dockerfile/postBuild
|
||||
See https://github.com/jupyter/repo2docker/issues/160 for reason
|
||||
"""
|
||||
from ctypes import cdll, c_void_p, memset
|
||||
import os
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../dockerfile/postBuild
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simplest program that tries to allocate a large amount of RAM.
|
||||
|
||||
malloc lies on Linux by default, so we use memset to force the
|
||||
kernel to actually give us real memory.
|
||||
|
||||
NOTE: This file has to be duplicated & present in all the following locations:
|
||||
- tests/memlimit/dockerfile/postBuild
|
||||
- tests/memlimit/dockerfile/postBuild
|
||||
See https://github.com/jupyter/repo2docker/issues/160 for reason
|
||||
"""
|
||||
from ctypes import cdll, c_void_p, memset
|
||||
import os
|
||||
|
||||
libc = cdll.LoadLibrary("libc.so.6")
|
||||
libc.malloc.restype = c_void_p
|
||||
|
||||
with open('mem_allocate_mb') as f:
|
||||
mem_allocate_mb = int(f.read().strip())
|
||||
|
||||
size = 1024 * 1024 * mem_allocate_mb
|
||||
print("trying to allocate {}MB".format(mem_allocate_mb))
|
||||
|
||||
ret = libc.malloc(size)
|
||||
|
||||
memset(ret, 0, size)
|
Ładowanie…
Reference in New Issue