def test_basic(self): """Basic sed""" s = sed() self.assertEqual(s.sed_step(file='foo', patterns=[r's/a/A/g', r's/FOO = BAR/FOO = BAZ/g']), r'''sed -i -e s/a/A/g \ -e 's/FOO = BAR/FOO = BAZ/g' foo''')
milc_cmds = [ 'mkdir -p /milc', wget().download_step( url='http://www.physics.utah.edu/~detar/milc/milc_qcd-{}.tar.gz'. format(milc_version)), tar().untar_step(tarball='/tmp/milc_qcd-{}.tar.gz'.format(milc_version), directory='/milc'), 'cd /milc/milc_qcd-{}/ks_imp_rhmc'.format(milc_version), 'cp ../Makefile .', sed().sed_step( file='/milc/milc_qcd-{}/ks_imp_rhmc/Makefile'.format(milc_version), patterns=[ r's/WANTQUDA\(.*\)=.*/WANTQUDA\1= true/g', r's/\(WANT_.*_GPU\)\(.*\)= .*/\1\2= true/g', r's/QUDA_HOME\(.*\)= .*/QUDA_HOME\1= \/quda\/build/g', r's/CUDA_HOME\(.*\)= .*/CUDA_HOME\1= \/usr\/local\/cuda/g', r's/#\?MPP = .*/MPP = true/g', r's/#\?CC = .*/CC = mpicc/g', r's/LD\(\s+\)= .*/LD\1= mpicxx/g', r's/PRECISION = [0-9]\+/PRECISION = 2/g', r's/WANTQIO = .*/WANTQIO = #true or blank. Implies HAVEQMP./g', r's/CGEOM =.*-DFIX_NODE_GEOM.*/CGEOM = #-DFIX_NODE_GEOM/g' ]), 'C_INCLUDE_PATH=/quda/build/include make su3_rhmd_hisq' ] Stage0 += shell(commands=milc_cmds) ############################################################################### # Release stage ############################################################################### Stage1 += baseimage(image='nvidia/cuda:9.0-base-ubuntu16.04') Stage1 += ofed.runtime()
def test_nopatterns(self): """No patterns specified""" s = sed() self.assertEqual(s.sed_step(file='foo'), '')
def test_nofile(self): """No file specified""" s = sed() self.assertEqual(s.sed_step(patterns=[r's/a/A/g']), '')