rpm/tests/rpmmacro.at

102 lines
1.4 KiB
Plaintext
Raw Normal View History

# rpmmacro.at: test rpm macros
#
2008-11-22 19:26:43 +08:00
AT_BANNER([RPM macros])
# ------------------------------
AT_SETUP([simple rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{this}'
],
[0],
[that
])
AT_CLEANUP
AT_SETUP([simple true conditional rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{?this}'
],
[0],
[that
])
AT_CLEANUP
AT_SETUP([simple false conditional rpm --eval])
AT_CHECK([
run rpm --define "this that" --eval '%{?that}'
],
[0],
[
])
AT_CLEANUP
AT_SETUP([uncompress macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--define "__gzip /my/bin/gzip" \
--eval "%{uncompress:hello-2.0.tar.gz}"
)
],
[0],
[/my/bin/gzip -dc hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([basename macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{basename:${RPMDATA}/SOURCES/hello-2.0.tar.gz}"
)
],
[0],
[hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([suffix macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{suffix:${RPMDATA}/SOURCES/hello-2.0.tar.gz}"
)
],
[0],
[gz
])
AT_CLEANUP
AT_SETUP([url2path macro])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%{url2path:http://hello.org/releases/hello-2.0.tar.gz}"
)
],
[0],
[/releases/hello-2.0.tar.gz
])
AT_CLEANUP
AT_SETUP([shell expansion])
AT_CHECK([
(cd ${RPMDATA}/SOURCES/ &&
run rpm \
--eval "%(echo foo)"
)
],
[0],
[foo
])
AT_CLEANUP
AT_SETUP([simple lua --eval])
AT_CHECK([
run rpm --eval '%{lua:print(5*5)}'
],
[0],
[25
])
AT_CLEANUP