summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/aml/package.py
blob: da155e7bdf74031a316be3446d27ba0613f45fec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os

from spack import *


class Aml(AutotoolsPackage):
    """AML: Building Blocks for Memory Management."""

    homepage = "https://argo-aml.readthedocs.io/"
    url = "https://www.mcs.anl.gov/research/projects/argo/downloads/aml-0.1.0.tar.gz"
    git = "https://github.com/anlsys/aml.git"
    maintainers = ['perarnau']

    test_requires_compiler = True

    tags = ['e4s']

    version('0.1.0', sha256='cc89a8768693f1f11539378b21cdca9f0ce3fc5cb564f9b3e4154a051dcea69b')
    version('master', branch='master', submodules=True)

    depends_on('numactl')

    with when('@master'):
        depends_on('m4', type='build')
        depends_on('autoconf', type='build')
        depends_on('automake', type='build')
        depends_on('libtool', type='build')

    @run_after('install')
    def cache_test_sources(self):
        """Copy the example source files after the package is installed to an
        install test subdirectory for use during `spack test run`."""
        self.cache_extra_test_sources(['tests', join_path('include', 'config.h')])

    def run_area_test(self):
        """Run stand alone test: test_area"""

        test_dir = join_path(self.test_suite.current_test_cache_dir, 'tests', 'area')

        if not os.path.exists(test_dir):
            print('Skipping aml test')
            return

        exe = 'test_area'

        self.run_test('gcc',
                      options=['-o', exe, join_path(test_dir, 'test_area.c'),
                               '-I{0}'.format(join_path(
                                   self.test_suite.current_test_cache_dir,
                                   'include')),
                               '-I{0}'.format(self.prefix.include),
                               '-I{0}'.format(self.spec['numactl'].prefix.include),
                               '-L{0}'.format(self.prefix.lib),
                               '-laml', '-lexcit', '-lpthread'],
                      purpose='test: compile {0} example'.format(exe),
                      work_dir=test_dir)

        self.run_test(exe,
                      purpose='test: run {0} example'.format(exe),
                      work_dir=test_dir)

    def test(self):
        self.run_area_test()