Skip to content

Commit

Permalink
Eliminate bunch of now unnecessary runroot_other() uses
Browse files Browse the repository at this point in the history
See previous commits for rationale.
  • Loading branch information
pmatilai authored and dmnks committed Nov 18, 2024
1 parent d4125a3 commit 3006c84
Showing 1 changed file with 34 additions and 38 deletions.
72 changes: 34 additions & 38 deletions tests/rpmmacro.at
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ RPMTEST_CLEANUP
AT_SETUP([uncompress 1])
AT_KEYWORDS([macros])
RPMTEST_CHECK([
RPMDB_INIT
runroot_other ${RPM_CONFIGDIR_PATH}/rpmuncompress /data/SOURCES/hello-2.0.tar.gz | tar t
${RPM_CONFIGDIR_PATH}/rpmuncompress /data/SOURCES/hello-2.0.tar.gz | tar t
],
[0],
[hello-2.0/
Expand All @@ -356,8 +355,8 @@ AT_SETUP([uncompress 2])
AT_KEYWORDS([macros])
RPMTEST_CHECK([
RPMDB_INIT
echo xxxxxxxxxxxxxxxxxxxxxxxxx > ${RPMTEST}/tmp/"some%%ath"
runroot_other ${RPM_CONFIGDIR_PATH}/rpmuncompress "/tmp/some%%ath"
echo xxxxxxxxxxxxxxxxxxxxxxxxx > "some%%ath"
${RPM_CONFIGDIR_PATH}/rpmuncompress "some%%ath"
],
[0],
[xxxxxxxxxxxxxxxxxxxxxxxxx
Expand All @@ -366,40 +365,39 @@ RPMTEST_CLEANUP

AT_SETUP([uncompress 3])
AT_KEYWORDS([macros rpmuncompress])
RPMDB_INIT

RPMTEST_CHECK([
runroot_other ${RPM_CONFIGDIR_PATH}/rpmuncompress -x -C /tmp/test-1.2.3 /data/SOURCES/test-1.2.3.zip
${RPM_CONFIGDIR_PATH}/rpmuncompress -x -C test-1.2.3 /data/SOURCES/test-1.2.3.zip
],
[0],
[])

RPMTEST_CHECK([
runroot_other ${RPM_CONFIGDIR_PATH}/rpmuncompress -x -C /tmp/test-1.2.3-7 /data/SOURCES/test-1.2.3.7z
${RPM_CONFIGDIR_PATH}/rpmuncompress -x -C test-1.2.3-7 /data/SOURCES/test-1.2.3.7z
],
[0],
[])


RPMTEST_CHECK([
runroot_other find /tmp/test-1.2.3 | sort
find test-1.2.3 | sort
],
[0],
[/tmp/test-1.2.3
/tmp/test-1.2.3/.gitignore
/tmp/test-1.2.3/README.txt
/tmp/test-1.2.3/src
/tmp/test-1.2.3/src/README.txt
[test-1.2.3
test-1.2.3/.gitignore
test-1.2.3/README.txt
test-1.2.3/src
test-1.2.3/src/README.txt
])
RPMTEST_CHECK([
runroot_other find /tmp/test-1.2.3-7 | sort
find test-1.2.3-7 | sort
],
[0],
[/tmp/test-1.2.3-7
/tmp/test-1.2.3-7/.gitignore
/tmp/test-1.2.3-7/README.txt
/tmp/test-1.2.3-7/src
/tmp/test-1.2.3-7/src/README.txt
[test-1.2.3-7
test-1.2.3-7/.gitignore
test-1.2.3-7/README.txt
test-1.2.3-7/src
test-1.2.3-7/src/README.txt
])
RPMTEST_CLEANUP

Expand Down Expand Up @@ -949,10 +947,9 @@ RPMTEST_CLEANUP

AT_SETUP([lua glob])
RPMTEST_CHECK([
RPMDB_INIT
runroot_other mkdir -p aaa/{123,223,323,322,321}
runroot rpm --eval "%{lua:for i,p in ipairs(rpm.glob('aaa/3*')) do print(p..'\\n') end}"
runroot rpm --eval "%{lua:for i,p in ipairs(rpm.glob('aaa/b*', 'c')) do print(p..'\\n') end}"
mkdir -p aaa/{123,223,323,322,321}
rpm --eval "%{lua:for i,p in ipairs(rpm.glob('aaa/3*')) do print(p..'\\n') end}"
rpm --eval "%{lua:for i,p in ipairs(rpm.glob('aaa/b*', 'c')) do print(p..'\\n') end}"
],
[0],
[aaa/321
Expand Down Expand Up @@ -1525,7 +1522,7 @@ AT_SETUP([rpmlua])
AT_KEYWORDS([lua])
RPMTEST_SETUP
RPMTEST_CHECK([
runroot_other rpmlua /data/t1.lua a b
rpmlua /data/t1.lua a b
],
[0],
[hello world
Expand All @@ -1538,7 +1535,7 @@ b
[])

RPMTEST_CHECK([
runroot_other rpmlua --opts=ot: /data/t1.lua -- -t1 a
rpmlua --opts=ot: /data/t1.lua -- -t1 a
],
[0],
[hello world
Expand All @@ -1550,15 +1547,15 @@ a
[])

RPMTEST_CHECK([
runroot_other rpmlua -e "print(macros.basename('/some/thing'))"
rpmlua -e "print(macros.basename('/some/thing'))"
],
[0],
[thing
],
[])

RPMTEST_CHECK([
runroot_other rpmlua -e "for i, v in ipairs({'true', 'false', 'grue'}) do print(rpm.execute('/bin/'..v)) end"
rpmlua -e "for i, v in ipairs({'true', 'false', 'grue'}) do print(rpm.execute('/bin/'..v)) end"
],
[0],
[0.0
Expand All @@ -1568,7 +1565,7 @@ nil No such file or directory 2.0
[])

RPMTEST_CHECK([
runroot_other rpmlua -e 'pid = posix.fork(); if pid == 0 then a,b,c=rpm.redirect2null(-1); print(string.format("%s\t%s\t%s", a,b,c)); io.flush() else posix.wait(pid) end'
rpmlua -e 'pid = posix.fork(); if pid == 0 then a,b,c=rpm.redirect2null(-1); print(string.format("%s\t%s\t%s", a,b,c)); io.flush() else posix.wait(pid) end'
],
[0],
[nil Bad file descriptor 9.0
Expand All @@ -1591,25 +1588,24 @@ RPMTEST_CLEANUP

AT_SETUP([lua rpm spawn])
AT_KEYWORDS([macros lua])
RPMDB_INIT
RPMTEST_CHECK([
runroot_other rpmlua -e "rpm.spawn({'echo', '1', '2', '3'})"
rpmlua -e "rpm.spawn({'echo', '1', '2', '3'})"
],
[0],
[1 2 3
],
[])

RPMTEST_CHECK([
runroot_other rpmlua \
rpmlua \
-e "rpm.spawn({'echo', '1', '2', '3'}, {stdout='/dev/null'})"
],
[0],
[],
[])

RPMTEST_CHECK([
runroot_other rpmlua \
rpmlua \
-e "rpm.spawn({'ls', '/notthere'})"
],
[0],
Expand All @@ -1618,15 +1614,15 @@ runroot_other rpmlua \
])

RPMTEST_CHECK([
runroot_other rpmlua \
rpmlua \
-e "rpm.spawn({'ls', '/notthere'}, {stderr='/dev/null'})"
],
[0],
[],
[])

RPMTEST_CHECK([
runroot_other rpmlua \
rpmlua \
-e "rpm.spawn({'ls', '/notthere'}, {garbage='bbb'})"
],
[255],
Expand All @@ -1635,24 +1631,24 @@ runroot_other rpmlua \
]])

RPMTEST_CHECK([
runroot_other rpmlua -e "rpm.spawn('echo', '1', '2', '3')"
rpmlua -e "rpm.spawn('echo', '1', '2', '3')"
],
[255],
[],
[[error: lua script failed: [string "<execute>"]:1: bad argument #1 to 'spawn' (table expected, got string)
]])

RPMTEST_CHECK([
runroot_other rpmlua -e "print(rpm.spawn({'cat'}, {stdin='aaa'}))"
rpmlua -e "print(rpm.spawn({'cat'}, {stdin='aaa'}))"
],
[0],
[nil No such file or directory 2.0
],
[])

RPMTEST_CHECK([
echo 1 2 3 > ${RPMTEST}/aaa
runroot_other rpmlua -e "rpm.spawn({'cat'}, {stdin='aaa'})"
echo 1 2 3 > aaa
rpmlua -e "rpm.spawn({'cat'}, {stdin='aaa'})"
],
[0],
[1 2 3
Expand Down

0 comments on commit 3006c84

Please sign in to comment.