Skip to content
Snippets Groups Projects
Commit cae4d0d3 authored by Tamara Dahlgren's avatar Tamara Dahlgren Committed by Gregory Becker
Browse files

tests: Preliminary m4 smoke tests (#14553)

* Preliminary m4 smoke tests
parent 06d3cead
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
import re import re
import os
import re
import llnl.util.tty as tty
class M4(AutotoolsPackage, GNUMirrorPackage): class M4(AutotoolsPackage, GNUMirrorPackage):
"""GNU M4 is an implementation of the traditional Unix macro processor.""" """GNU M4 is an implementation of the traditional Unix macro processor."""
...@@ -76,3 +81,24 @@ def configure_args(self): ...@@ -76,3 +81,24 @@ def configure_args(self):
args.append('ac_cv_type_struct_sched_param=yes') args.append('ac_cv_type_struct_sched_param=yes')
return args return args
def test(self):
m4 = which('m4')
assert m4 is not None
tty.msg('test: Ensuring use of the installed executable')
m4_dir = os.path.dirname(m4.path)
assert m4_dir == self.prefix.bin
tty.msg('test: Checking version')
output = m4('--version', output=str.split, error=str.split)
version_regex = re.compile(r'm4(.+){0}'.format(self.spec.version))
assert version_regex.search(output)
tty.msg('test: Ensuring m4 runs')
currdir = os.getcwd()
hello_file = os.path.join(currdir, 'data', 'hello.m4')
output = m4(hello_file, output=str.split, error=str.split)
expected_file = os.path.join(currdir, 'data', 'hello.out')
with open(expected_file) as fd:
assert output == fd.read()
define(NAME, World)
dnl This line should not show up
// macro is ifdef(`NAME', , not)defined
Hello, NAME!
// macro is defined
Hello, World!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment