From 0d192f8cf3c21b2382e227fab057dabe16ea5e8b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 17 Jun 2019 14:54:26 +0200 Subject: reduce code duplication by giving each known allocator its own class also move allocator related code to src/allocators --- src/allocators/glibc.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/allocators/glibc.py (limited to 'src/allocators/glibc.py') diff --git a/src/allocators/glibc.py b/src/allocators/glibc.py new file mode 100644 index 0000000..eff71dc --- /dev/null +++ b/src/allocators/glibc.py @@ -0,0 +1,29 @@ +import src.allocator + + +version = 2.29 + +glibc_src = src.allocator.Allocator_Sources("glibc", + retrieve_cmds=["git clone git://sourceware.org/git/glibc.git"], + prepare_cmds=["git checkout release/{}/master".format(version)], + reset_cmds=["git stash"]) + +class Glibc (src.allocator.Allocator): + """Glibc definition for allocbench""" + def __init__(self, name, **kwargs): + + kwargs["sources"] = glibc_src + + configure_args = "" + if "configure_args" in kwargs: + configure_args = kwargs["configure_args"] + del(kwargs["configure_args"]) + + kwargs["build_cmds"] = ["mkdir -p glibc-build", + "cd glibc-build; {srcdir}/configure --prefix={dir} " + configure_args, + "cd glibc-build; make", + "cd glibc-build; make install"] + kwargs["cmd_prefix"] = ("{dir}/lib/ld-linux-x86-64.so.2 --library-path {dir}/lib:" + + src.allocator.library_path) + + super().__init__(name, **kwargs) -- cgit v1.2.3