@@ -56,6 +56,70 @@ def tearDown(self):
5656 easybuild .tools .build_log .EXPERIMENTAL = self .orig_experimental
5757 super (EasyStackTest , self ).tearDown ()
5858
59+ def test_easystack_basic (self ):
60+ """Test for basic easystack file."""
61+ topdir = os .path .dirname (os .path .abspath (__file__ ))
62+ test_easystack = os .path .join (topdir , 'easystacks' , 'test_easystack_basic.yaml' )
63+
64+ ec_fns , opts = parse_easystack (test_easystack )
65+ expected = [
66+ 'binutils-2.25-GCCcore-4.9.3.eb' ,
67+ 'binutils-2.26-GCCcore-4.9.3.eb' ,
68+ 'foss-2018a.eb' ,
69+ 'toy-0.0-gompi-2018a-test.eb' ,
70+ ]
71+ self .assertEqual (sorted (ec_fns ), sorted (expected ))
72+ self .assertEqual (opts , {})
73+
74+ def test_easystack_easyconfigs (self ):
75+ """Test for easystack file using 'easyconfigs' key."""
76+ topdir = os .path .dirname (os .path .abspath (__file__ ))
77+ test_easystack = os .path .join (topdir , 'easystacks' , 'test_easystack_easyconfigs.yaml' )
78+
79+ ec_fns , opts = parse_easystack (test_easystack )
80+ expected = [
81+ 'binutils-2.25-GCCcore-4.9.3.eb' ,
82+ 'binutils-2.26-GCCcore-4.9.3.eb' ,
83+ 'foss-2018a.eb' ,
84+ 'toy-0.0-gompi-2018a-test.eb' ,
85+ ]
86+ self .assertEqual (sorted (ec_fns ), sorted (expected ))
87+ self .assertEqual (opts , {})
88+
89+ def test_easystack_easyconfigs_with_eb_ext (self ):
90+ """Test for easystack file using 'easyconfigs' key, where eb extension is included in the easystack file"""
91+ topdir = os .path .dirname (os .path .abspath (__file__ ))
92+ test_easystack = os .path .join (topdir , 'easystacks' , 'test_easystack_easyconfigs_with_eb_ext.yaml' )
93+
94+ ec_fns , opts = parse_easystack (test_easystack )
95+ expected = [
96+ 'binutils-2.25-GCCcore-4.9.3.eb' ,
97+ 'binutils-2.26-GCCcore-4.9.3.eb' ,
98+ 'foss-2018a.eb' ,
99+ 'toy-0.0-gompi-2018a-test.eb' ,
100+ ]
101+ self .assertEqual (sorted (ec_fns ), sorted (expected ))
102+ self .assertEqual (opts , {})
103+
104+ def test_easystack_easyconfig_opts (self ):
105+ """Test an easystack file using the 'easyconfigs' key, with additonal options for some easyconfigs"""
106+ topdir = os .path .dirname (os .path .abspath (__file__ ))
107+ test_easystack = os .path .join (topdir , 'easystacks' , 'test_easystack_easyconfigs_opts.yaml' )
108+
109+ ec_fns , opts = parse_easystack (test_easystack )
110+ expected = [
111+ 'binutils-2.25-GCCcore-4.9.3.eb' ,
112+ 'binutils-2.26-GCCcore-4.9.3.eb' ,
113+ 'foss-2018a.eb' ,
114+ 'toy-0.0-gompi-2018a-test.eb' ,
115+ ]
116+ expected_opts = {
117+ 'binutils-2.25-GCCcore-4.9.3.eb' : {'debug' : True , 'from-pr' : 12345 },
118+ 'foss-2018a.eb' : {'enforce-checksums' : True , 'robot' : True },
119+ }
120+ self .assertEqual (sorted (ec_fns ), sorted (expected ))
121+ self .assertEqual (opts , expected_opts )
122+
59123 def test_parse_fail (self ):
60124 """Test for clean error when easystack file fails to parse."""
61125 test_yml = os .path .join (self .test_prefix , 'test.yml' )
@@ -120,15 +184,17 @@ def test_easystack_versions(self):
120184 versions = ('1.2.3' , '1.2.30' , '2021a' , '1.2.3' )
121185 for version in versions :
122186 write_file (test_easystack , tmpl_easystack_txt + ' ' + version )
123- ec_fns , _ = parse_easystack (test_easystack )
187+ ec_fns , opts = parse_easystack (test_easystack )
124188 self .assertEqual (ec_fns , ['foo-%s.eb' % version ])
189+ self .assertEqual (opts , {})
125190
126191 # multiple versions as a list
127192 test_easystack_txt = tmpl_easystack_txt + " [1.2.3, 3.2.1]"
128193 write_file (test_easystack , test_easystack_txt )
129- ec_fns , _ = parse_easystack (test_easystack )
194+ ec_fns , opts = parse_easystack (test_easystack )
130195 expected = ['foo-1.2.3.eb' , 'foo-3.2.1.eb' ]
131196 self .assertEqual (sorted (ec_fns ), sorted (expected ))
197+ self .assertEqual (opts , {})
132198
133199 # multiple versions listed with more info
134200 test_easystack_txt = '\n ' .join ([
@@ -139,9 +205,10 @@ def test_easystack_versions(self):
139205 " versionsuffix: -foo" ,
140206 ])
141207 write_file (test_easystack , test_easystack_txt )
142- ec_fns , _ = parse_easystack (test_easystack )
208+ ec_fns , opts = parse_easystack (test_easystack )
143209 expected = ['foo-1.2.3.eb' , 'foo-2021a.eb' , 'foo-3.2.1-foo.eb' ]
144210 self .assertEqual (sorted (ec_fns ), sorted (expected ))
211+ self .assertEqual (opts , {})
145212
146213 # versions that get interpreted by YAML as float or int, single quotes required
147214 for version in ('1.2' , '123' , '3.50' , '100' , '2.44_01' ):
@@ -152,8 +219,9 @@ def test_easystack_versions(self):
152219
153220 # all is fine when wrapping the value in single quotes
154221 write_file (test_easystack , tmpl_easystack_txt + " '" + version + "'" )
155- ec_fns , _ = parse_easystack (test_easystack )
222+ ec_fns , opts = parse_easystack (test_easystack )
156223 self .assertEqual (ec_fns , ['foo-%s.eb' % version ])
224+ self .assertEqual (opts , {})
157225
158226 # one rotten apple in the basket is enough
159227 test_easystack_txt = tmpl_easystack_txt + " [1.2.3, %s, 3.2.1]" % version
@@ -179,9 +247,10 @@ def test_easystack_versions(self):
179247 " versionsuffix: -foo" ,
180248 ])
181249 write_file (test_easystack , test_easystack_txt )
182- ec_fns , _ = parse_easystack (test_easystack )
250+ ec_fns , opts = parse_easystack (test_easystack )
183251 expected = ['foo-1.2.3.eb' , 'foo-%s.eb' % version , 'foo-3.2.1-foo.eb' ]
184252 self .assertEqual (sorted (ec_fns ), sorted (expected ))
253+ self .assertEqual (opts , {})
185254
186255 # also check toolchain version that could be interpreted as a non-string value...
187256 test_easystack_txt = '\n ' .join ([
@@ -192,9 +261,10 @@ def test_easystack_versions(self):
192261 " versions: [1.2.3, '2.3']" ,
193262 ])
194263 write_file (test_easystack , test_easystack_txt )
195- ec_fns , _ = parse_easystack (test_easystack )
264+ ec_fns , opts = parse_easystack (test_easystack )
196265 expected = ['test-1.2.3-intel-2021.03.eb' , 'test-2.3-intel-2021.03.eb' ]
197266 self .assertEqual (sorted (ec_fns ), sorted (expected ))
267+ self .assertEqual (opts , {})
198268
199269
200270def suite ():
0 commit comments