diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-12 15:17:20 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-12 15:17:20 +0900 |
commit | 7df2385c2f6c93f96e00bc87f2086066cae89ecc (patch) | |
tree | 79d5c20a494622eb084de831a2a51530cd421e33 /tests/rpmmacro.at | |
parent | b7a3bffb8e0341b7e4ef69def268bca3a7f279ff (diff) | |
download | rpm-7df2385c2f6c93f96e00bc87f2086066cae89ecc.tar.gz rpm-7df2385c2f6c93f96e00bc87f2086066cae89ecc.tar.bz2 rpm-7df2385c2f6c93f96e00bc87f2086066cae89ecc.zip |
Tizen 2.1 basesubmit/tizen_2.2/20130710.072219submit/tizen_2.1/20130423.104200accepted/tizen_2.1/20130423.1513382.2_release2.2.1_release2.1b_releasetizen_2.2tizen_2.1
Diffstat (limited to 'tests/rpmmacro.at')
-rw-r--r-- | tests/rpmmacro.at | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at new file mode 100644 index 0000000..dfec846 --- /dev/null +++ b/tests/rpmmacro.at @@ -0,0 +1,144 @@ +# rpmmacro.at: test rpm macros +# +AT_BANNER([RPM macros]) + +# ------------------------------ +AT_SETUP([simple rpm --eval]) +AT_KEYWORDS([macros]) +AT_CHECK([ +run rpm --define "this that" --eval '%{this}' +], +[0], +[that +]) +AT_CLEANUP + +AT_SETUP([simple true conditional rpm --eval]) +AT_KEYWORDS([macros]) +AT_CHECK([ +run rpm --define "this that" --eval '%{?this}' +], +[0], +[that +]) +AT_CLEANUP + +AT_SETUP([simple false conditional rpm --eval]) +AT_KEYWORDS([macros]) +AT_CHECK([ +run rpm --define "this that" --eval '%{?that}' +], +[0], +[ +]) +AT_CLEANUP + +AT_SETUP([uncompress macro]) +AT_KEYWORDS([macros]) +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_KEYWORDS([macros]) +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_KEYWORDS([macros]) +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_KEYWORDS([macros]) +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_KEYWORDS([macros]) +AT_CHECK([ +(cd ${RPMDATA}/SOURCES/ && + run rpm \ + --eval "%(echo foo)" +) +], +[0], +[foo +]) +AT_CLEANUP + +AT_SETUP([simple lua --eval]) +AT_KEYWORDS([macros lua]) +AT_CHECK([ +run rpm --eval '%{lua:print(5*5)}' +], +[0], +[25 +]) +AT_CLEANUP + +AT_SETUP([lua rpm extensions]) +AT_KEYWORDS([macros lua]) +AT_CHECK([ +run rpm --eval '%{lua: rpm.define("foo bar") print(rpm.expand("%{foo}"))}' +], +[0], +[bar +]) +AT_CLEANUP + +AT_SETUP([lua posix extensions]) +AT_KEYWORDS([macros lua]) +AT_CHECK([ +run rpm \ + --eval '%{lua: posix.putenv("LUATEST=ok") print(posix.getenv("LUATEST"))}' +], +[0], +[ok +]) +AT_CLEANUP + +AT_SETUP([lua script exit behavior]) +AT_KEYWORDS([macros lua]) +AT_CHECK([ +run rpm \ + --eval '%{lua: os.exit()}))}' +], +[0], +[ +], +[error: lua script failed: [[string "<lua>"]]:1: exit not permitted in this context] +) +AT_CLEANUP |