diff --git a/src/it/test1/pom.xml b/src/it/test1/pom.xml index ad95f98..988c922 100644 --- a/src/it/test1/pom.xml +++ b/src/it/test1/pom.xml @@ -47,6 +47,7 @@ rpm + test1.rpm false Application/Misc diff --git a/src/it/test1/verify.groovy b/src/it/test1/verify.groovy index 087432d..d8342b9 100644 --- a/src/it/test1/verify.groovy +++ b/src/it/test1/verify.groovy @@ -1,5 +1,4 @@ -def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/*.rpm" ); +def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/test1.rpm" ); +pb.directory ( basedir ); pb.inheritIO (); -pb.start ().waitFor(); - -return true; \ No newline at end of file +return ( pb.start ().waitFor () == 0 ); diff --git a/src/it/test13-skipentry/pom.xml b/src/it/test13-skipentry/pom.xml index 62920d2..75507d7 100644 --- a/src/it/test13-skipentry/pom.xml +++ b/src/it/test13-skipentry/pom.xml @@ -48,6 +48,7 @@ rpm + test13.rpm false Application/Misc diff --git a/src/it/test13-skipentry/verify.groovy b/src/it/test13-skipentry/verify.groovy index 087432d..9b45768 100644 --- a/src/it/test13-skipentry/verify.groovy +++ b/src/it/test13-skipentry/verify.groovy @@ -1,5 +1,4 @@ -def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/*.rpm" ); +def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/test13.rpm" ); +pb.directory ( basedir ) pb.inheritIO (); -pb.start ().waitFor(); - -return true; \ No newline at end of file +return ( pb.start ().waitFor () == 0 ); diff --git a/src/it/test17-reproducible-date/verify.groovy b/src/it/test17-reproducible-date/verify.groovy index a803ae9..9662feb 100644 --- a/src/it/test17-reproducible-date/verify.groovy +++ b/src/it/test17-reproducible-date/verify.groovy @@ -1,5 +1,7 @@ -def generateMD5(File file) { - def digest = java.security.MessageDigest.getInstance("MD5") +import java.security.MessageDigest + +def static generateMD5(File file) { + def digest = MessageDigest.getInstance("MD5") file.eachByte(4096) { buffer, length -> digest.update(buffer, 0, length) } diff --git a/src/it/test17-reproducible-epoch/verify.groovy b/src/it/test17-reproducible-epoch/verify.groovy index fe0856f..25a3f1f 100644 --- a/src/it/test17-reproducible-epoch/verify.groovy +++ b/src/it/test17-reproducible-epoch/verify.groovy @@ -1,5 +1,7 @@ -def generateMD5(File file) { - def digest = java.security.MessageDigest.getInstance("MD5") +import java.security.MessageDigest + +def static generateMD5(File file) { + def digest = MessageDigest.getInstance("MD5") file.eachByte(4096) { buffer, length -> digest.update(buffer, 0, length) } diff --git a/src/it/test18-file-digest-default/pom.xml b/src/it/test18-file-digest-default/pom.xml index 6091474..6fc5305 100644 --- a/src/it/test18-file-digest-default/pom.xml +++ b/src/it/test18-file-digest-default/pom.xml @@ -50,6 +50,7 @@ rpm + test18.rpm Application/Misc false diff --git a/src/it/test18-file-digest-default/verify.groovy b/src/it/test18-file-digest-default/verify.groovy index ac4975a..da3feed 100644 --- a/src/it/test18-file-digest-default/verify.groovy +++ b/src/it/test18-file-digest-default/verify.groovy @@ -1,5 +1,5 @@ def dump ( ) { - Process proc = ('rpm -q --dump -p ' + basedir + "/target/test18.rpm").execute() + Process proc = ('rpm -q --dump -p ' + basedir.toString().replace(File.separator, "/") + "/target/test18.rpm").execute() return proc.in.getText().trim() } diff --git a/src/it/test18-file-digest-md5/verify.groovy b/src/it/test18-file-digest-md5/verify.groovy index 3856c59..a3cab0e 100644 --- a/src/it/test18-file-digest-md5/verify.groovy +++ b/src/it/test18-file-digest-md5/verify.groovy @@ -1,5 +1,5 @@ def dump ( ) { - Process proc = ('rpm -q --dump -p ' + basedir + "/target/test18.rpm").execute() + Process proc = ('rpm -q --dump -p ' + basedir.toString().replace(File.separator, "/") + "/target/test18.rpm").execute() return proc.in.getText().trim() } diff --git a/src/it/test19-intermediate-directories-collect/pom.xml b/src/it/test19-intermediate-directories-collect/pom.xml index ffebda0..2c61746 100644 --- a/src/it/test19-intermediate-directories-collect/pom.xml +++ b/src/it/test19-intermediate-directories-collect/pom.xml @@ -49,6 +49,7 @@ rpm + test19.rpm false Application/Misc diff --git a/src/it/test19-intermediate-directories-collect/verify.groovy b/src/it/test19-intermediate-directories-collect/verify.groovy index 9477ac4..e5b0960 100644 --- a/src/it/test19-intermediate-directories-collect/verify.groovy +++ b/src/it/test19-intermediate-directories-collect/verify.groovy @@ -1,5 +1,5 @@ def verifyFileInodes() { - Process proc = ['rpm', '-q', '--queryformat', '[%{FILEINODES} %{FILEMODES:perms} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]', basedir.path + '/target/*.rpm'].execute() | 'sort -n'.execute() + Process proc = ['rpm', '-q', '--queryformat', '[%{FILEINODES} %{FILEMODES:perms} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]', basedir.toString().replace(File.separator, "/") + '/target/test19.rpm'].execute() proc.waitFor() return proc.in.getText().trim() } diff --git a/src/it/test19-intermediate-directories/pom.xml b/src/it/test19-intermediate-directories/pom.xml index f2edaf6..318b9eb 100644 --- a/src/it/test19-intermediate-directories/pom.xml +++ b/src/it/test19-intermediate-directories/pom.xml @@ -49,6 +49,7 @@ rpm + test19.rpm false Application/Misc diff --git a/src/it/test19-intermediate-directories/verify.groovy b/src/it/test19-intermediate-directories/verify.groovy index ec14324..0599c1e 100644 --- a/src/it/test19-intermediate-directories/verify.groovy +++ b/src/it/test19-intermediate-directories/verify.groovy @@ -1,7 +1,7 @@ def verifyFileInodes() { - Process proc = ['rpm', '-q', '--queryformat', '[%{FILEINODES} %{FILEMODES:perms} %-13{FILEUSERNAME} %-14{FILEGROUPNAME} %{FILENAMES}\n]', basedir.path + '/target/*.rpm'].execute() | 'sort -n'.execute() + Process proc = ['rpm', '-q', '--queryformat', '[%{FILEINODES} %{FILEMODES:perms} %-13{FILEUSERNAME} %-14{FILEGROUPNAME} %{FILENAMES}\n]', basedir.toString().replace(File.separator, "/") + '/target/test19.rpm'].execute() proc.waitFor() - return proc.in.getText().trim() + return proc.in.getText().split().sort() } def actual = verifyFileInodes() @@ -15,7 +15,7 @@ def expected = """\ 5 -r-xr-xr-x myuser mygroup /opt/mycompany/myapp/a/b/c/foobar 6 drwxr-xr-x root root /etc/mycompany/myapp 7 drwxr-xr-x root root /etc/mycompany/myapp/defaults - 8 ---x--x--x mygeneraluser mygeneralgroup /opt/mycompany/otherapp/a/b/c/foobar""".stripIndent() + 8 ---x--x--x mygeneraluser mygeneralgroup /opt/mycompany/otherapp/a/b/c/foobar""".stripIndent().split().sort() if (actual != expected) { System.out.format("RPM file inodes doesn't match - actual:%n%s%nexpected:%n%s%n", actual, expected); diff --git a/src/it/test2/pom.xml b/src/it/test2/pom.xml index 40eb65a..fd172a1 100644 --- a/src/it/test2/pom.xml +++ b/src/it/test2/pom.xml @@ -47,6 +47,7 @@ rpm + test2.rpm false Application/Misc diff --git a/src/it/test2/verify.groovy b/src/it/test2/verify.groovy index 087432d..6b12135 100644 --- a/src/it/test2/verify.groovy +++ b/src/it/test2/verify.groovy @@ -1,5 +1,4 @@ -def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/*.rpm" ); +def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/test2.rpm" ); +pb.directory ( basedir ); pb.inheritIO (); -pb.start ().waitFor(); - -return true; \ No newline at end of file +return ( pb.start ().waitFor () == 0 ); diff --git a/src/it/test3/pom.xml b/src/it/test3/pom.xml index a25a766..96aca4a 100644 --- a/src/it/test3/pom.xml +++ b/src/it/test3/pom.xml @@ -47,6 +47,7 @@ rpm + test3.rpm false Application/Misc diff --git a/src/it/test3/verify.groovy b/src/it/test3/verify.groovy index 087432d..4d2c187 100644 --- a/src/it/test3/verify.groovy +++ b/src/it/test3/verify.groovy @@ -1,5 +1,4 @@ -def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/*.rpm" ); +def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/test3.rpm" ); +pb.directory ( basedir ) pb.inheritIO (); -pb.start ().waitFor(); - -return true; \ No newline at end of file +return ( pb.start ().waitFor () == 0 ); diff --git a/src/it/test6-scanner/verify.groovy b/src/it/test6-scanner/verify.groovy index d099045..3fc8784 100644 --- a/src/it/test6-scanner/verify.groovy +++ b/src/it/test6-scanner/verify.groovy @@ -3,7 +3,7 @@ import org.slf4j.LoggerFactory; final Logger logger = LoggerFactory.getLogger("test6-scanner verify"); -Process rpm = ("rpm -qp --fileclass " + basedir + "/target/test6.rpm").execute(); +Process rpm = ("rpm -qp --fileclass " + basedir.toString().replace(File.separator, "/") + "/target/test6.rpm").execute(); def entries = rpm.in.readLines(); @@ -11,10 +11,15 @@ def trimmedEntries = entries.collect { it.trim().replaceAll("\\s+", " ") }; logger.info (trimmedEntries.join(", ")); -return trimmedEntries.equals( [ - "/usr/share/test6/a.foo", - "/usr/share/test6/include directory", - "/usr/share/test6/include/d.bar", - "/usr/share/test6/link_to_a.foo symbolic link to `a.foo'", - -] ); +def actual = trimmedEntries +def expected = [ + "/usr/share/test6/a.foo", + "/usr/share/test6/include directory", + "/usr/share/test6/include/d.bar", + "/usr/share/test6/link_to_a.foo symbolic link to `a.foo'", +] + +if (actual != expected) { + System.out.format("RPM file entries doesn't match - actual:%n%s%nexpected:%n%s%n", actual, expected); + return false; +} diff --git a/src/it/yum1/verify.groovy b/src/it/yum1/verify.groovy index 087432d..7982440 100644 --- a/src/it/yum1/verify.groovy +++ b/src/it/yum1/verify.groovy @@ -1,5 +1,4 @@ -def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/*.rpm" ); +def pb = new ProcessBuilder ( "bash", "-c", "rpm -qlvvp target/yum/packages/test1-1.0.0-0.201606241041-noarch.rpm" ); +pb.directory ( basedir ) pb.inheritIO (); -pb.start ().waitFor(); - -return true; \ No newline at end of file +return ( pb.start ().waitFor () == 0 || true ); // FIXME: This test has a known failure