Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/test/scripts/makepkg-template-tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/scripts/makepkg-template-tests')
-rw-r--r--test/scripts/makepkg-template-tests/invalid-key/PKGBUILD1
-rw-r--r--test/scripts/makepkg-template-tests/invalid-key/testcase-config11
-rw-r--r--test/scripts/makepkg-template-tests/invalid-template-line-missing-name/PKGBUILD1
-rw-r--r--test/scripts/makepkg-template-tests/invalid-template-line-missing-name/testcase-config11
-rw-r--r--test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/PKGBUILD9
-rw-r--r--test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/testcase-config11
-rw-r--r--test/scripts/makepkg-template-tests/keep-old-version/PKGBUILD15
-rw-r--r--test/scripts/makepkg-template-tests/keep-old-version/templates/perl-bla-1.2.template1
-rw-r--r--test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.0.template6
-rw-r--r--test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.1.template7
-rw-r--r--test/scripts/makepkg-template-tests/keep-old-version/testcase-config29
-rw-r--r--test/scripts/makepkg-template-tests/missing-template-file/PKGBUILD7
-rw-r--r--test/scripts/makepkg-template-tests/missing-template-file/testcase-config14
-rw-r--r--test/scripts/makepkg-template-tests/missing-template-symlink/PKGBUILD7
-rw-r--r--test/scripts/makepkg-template-tests/missing-template-symlink/templates/perl-module-1.0.template1
-rw-r--r--test/scripts/makepkg-template-tests/missing-template-symlink/testcase-config9
-rw-r--r--test/scripts/makepkg-template-tests/name-charset-invalid/PKGBUILD8
-rw-r--r--test/scripts/makepkg-template-tests/name-charset-invalid/testcase-config10
-rw-r--r--test/scripts/makepkg-template-tests/name-charset-valid/PKGBUILD8
-rw-r--r--test/scripts/makepkg-template-tests/name-charset-valid/templates/foo@-_.+a-1.template1
-rw-r--r--test/scripts/makepkg-template-tests/name-charset-valid/testcase-config19
-rw-r--r--test/scripts/makepkg-template-tests/template-without-version/PKGBUILD8
-rw-r--r--test/scripts/makepkg-template-tests/template-without-version/templates/template-without_version.template0
-rw-r--r--test/scripts/makepkg-template-tests/template-without-version/testcase-config9
-rw-r--r--test/scripts/makepkg-template-tests/testcase-config-template9
-rw-r--r--test/scripts/makepkg-template-tests/update-version-with-newest-option/PKGBUILD7
-rw-r--r--test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-bla-1.2.template1
-rw-r--r--test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.0.template6
-rw-r--r--test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.1.template7
-rw-r--r--test/scripts/makepkg-template-tests/update-version-with-newest-option/testcase-config29
30 files changed, 262 insertions, 0 deletions
diff --git a/test/scripts/makepkg-template-tests/invalid-key/PKGBUILD b/test/scripts/makepkg-template-tests/invalid-key/PKGBUILD
new file mode 100644
index 00000000..02bfadcc
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-key/PKGBUILD
@@ -0,0 +1 @@
+# template input; []³|>=bar;
diff --git a/test/scripts/makepkg-template-tests/invalid-key/testcase-config b/test/scripts/makepkg-template-tests/invalid-key/testcase-config
new file mode 100644
index 00000000..4e4725e2
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-key/testcase-config
@@ -0,0 +1,11 @@
+arguments+=()
+expected_exitcode=255
+
+# set IFS="" if you want trailing new lines, otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+invalid key/value pair
+./makepkg-template-tests/invalid-key/PKGBUILD:1: # template input; []³|>=bar;
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/PKGBUILD b/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/PKGBUILD
new file mode 100644
index 00000000..d0a20c18
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/PKGBUILD
@@ -0,0 +1 @@
+# template input;
diff --git a/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/testcase-config b/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/testcase-config
new file mode 100644
index 00000000..6bfda327
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-template-line-missing-name/testcase-config
@@ -0,0 +1,11 @@
+arguments+=()
+expected_exitcode=255
+
+# set IFS="" if you want trailing new lines, otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+invalid template line: can't find template name
+./makepkg-template-tests/invalid-template-line-missing-name/PKGBUILD:1: # template input;
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/PKGBUILD b/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/PKGBUILD
new file mode 100644
index 00000000..645ea371
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/PKGBUILD
@@ -0,0 +1,9 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template boom; name=test
+perl Makefile.pl
+make
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/testcase-config b/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/testcase-config
new file mode 100644
index 00000000..077a85c3
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/invalid-template-line-unknown-marker/testcase-config
@@ -0,0 +1,11 @@
+arguments+=()
+expected_exitcode=255
+
+# set IFS="" if you want trailing new lines, otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+Unknown template marker 'boom'
+./makepkg-template-tests/invalid-template-line-unknown-marker/PKGBUILD:5: # template boom; name=test
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/keep-old-version/PKGBUILD b/test/scripts/makepkg-template-tests/keep-old-version/PKGBUILD
new file mode 100644
index 00000000..09da2e03
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/keep-old-version/PKGBUILD
@@ -0,0 +1,15 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module; version=1.0;
+echo "before bla template"
+# template start; name=perl-bla; version=1.2;
+bla bla
+# template end;
+echo "after bla template"
+perl Makefile.pl
+make
+make install
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-bla-1.2.template b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-bla-1.2.template
new file mode 100644
index 00000000..b72e7d48
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-bla-1.2.template
@@ -0,0 +1 @@
+bla bla
diff --git a/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.0.template b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.0.template
new file mode 100644
index 00000000..415025ac
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.0.template
@@ -0,0 +1,6 @@
+echo "before bla template"
+# template input; name=perl-bla
+echo "after bla template"
+perl Makefile.pl
+make
+make install
diff --git a/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.1.template b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.1.template
new file mode 100644
index 00000000..5ad32c3c
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/keep-old-version/templates/perl-module-1.1.template
@@ -0,0 +1,7 @@
+echo "perl-module version 1.1"
+echo "before bla template"
+# template input; name=perl-bla
+echo "after bla template"
+perl Makefile.pl
+make
+make install
diff --git a/test/scripts/makepkg-template-tests/keep-old-version/testcase-config b/test/scripts/makepkg-template-tests/keep-old-version/testcase-config
new file mode 100644
index 00000000..b9448a08
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/keep-old-version/testcase-config
@@ -0,0 +1,29 @@
+arguments+=()
+expected_exitcode=0
+
+_setup_testcase() {
+ ln -sr "templates/"{perl-bla-1.2.template,perl-bla.template}
+ ln -sr "templates/"{perl-module-1.1.template,perl-module.template}
+}
+
+# set IFS="" if you want trailing new lines, otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module; version=1.0;
+echo "before bla template"
+# template start; name=perl-bla; version=1.2;
+bla bla
+# template end;
+echo "after bla template"
+perl Makefile.pl
+make
+make install
+# template end;
+}
+EOF
diff --git a/test/scripts/makepkg-template-tests/missing-template-file/PKGBUILD b/test/scripts/makepkg-template-tests/missing-template-file/PKGBUILD
new file mode 100644
index 00000000..dbfda1dd
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/missing-template-file/PKGBUILD
@@ -0,0 +1,7 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module; version=1.0;
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/missing-template-file/testcase-config b/test/scripts/makepkg-template-tests/missing-template-file/testcase-config
new file mode 100644
index 00000000..bdfde40d
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/missing-template-file/testcase-config
@@ -0,0 +1,14 @@
+arguments+=()
+expected_exitcode=2
+
+_setup_testcase() {
+ ln -sr "templates/"{perl-module-1.0.template,perl-module.template}
+}
+
+# set IFS="" if you want trailing new lines, otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+failed to open './makepkg-template-tests/missing-template-file/templates/perl-module-1.0.template': No such file or directory
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/missing-template-symlink/PKGBUILD b/test/scripts/makepkg-template-tests/missing-template-symlink/PKGBUILD
new file mode 100644
index 00000000..8ee94aca
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/missing-template-symlink/PKGBUILD
@@ -0,0 +1,7 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module;
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/missing-template-symlink/templates/perl-module-1.0.template b/test/scripts/makepkg-template-tests/missing-template-symlink/templates/perl-module-1.0.template
new file mode 100644
index 00000000..f499d252
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/missing-template-symlink/templates/perl-module-1.0.template
@@ -0,0 +1 @@
+this should not be included
diff --git a/test/scripts/makepkg-template-tests/missing-template-symlink/testcase-config b/test/scripts/makepkg-template-tests/missing-template-symlink/testcase-config
new file mode 100644
index 00000000..c0eabe0d
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/missing-template-symlink/testcase-config
@@ -0,0 +1,9 @@
+arguments+=()
+expected_exitcode=255
+
+IFS="" read -d '' expected_output <<'EOF'
+Couldn't detect version for template 'perl-module'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/name-charset-invalid/PKGBUILD b/test/scripts/makepkg-template-tests/name-charset-invalid/PKGBUILD
new file mode 100644
index 00000000..36ed75bb
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/name-charset-invalid/PKGBUILD
@@ -0,0 +1,8 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=foo/
+make install
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/name-charset-invalid/testcase-config b/test/scripts/makepkg-template-tests/name-charset-invalid/testcase-config
new file mode 100644
index 00000000..7ea9502c
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/name-charset-invalid/testcase-config
@@ -0,0 +1,10 @@
+arguments+=()
+expected_exitcode=255
+
+IFS="" read -d '' expected_output <<'EOF'
+invalid chars used in name 'foo/'. allowed: [:alnum:]+_.@-
+./makepkg-template-tests/name-charset-invalid/PKGBUILD:5: # template start; name=foo/
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/name-charset-valid/PKGBUILD b/test/scripts/makepkg-template-tests/name-charset-valid/PKGBUILD
new file mode 100644
index 00000000..ec21cdb4
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/name-charset-valid/PKGBUILD
@@ -0,0 +1,8 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=foo@-_.+a
+make install
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/name-charset-valid/templates/foo@-_.+a-1.template b/test/scripts/makepkg-template-tests/name-charset-valid/templates/foo@-_.+a-1.template
new file mode 100644
index 00000000..d0884a6c
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/name-charset-valid/templates/foo@-_.+a-1.template
@@ -0,0 +1 @@
+42 cookies
diff --git a/test/scripts/makepkg-template-tests/name-charset-valid/testcase-config b/test/scripts/makepkg-template-tests/name-charset-valid/testcase-config
new file mode 100644
index 00000000..409444a9
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/name-charset-valid/testcase-config
@@ -0,0 +1,19 @@
+arguments+=()
+expected_exitcode=0
+
+_setup_testcase() {
+ ln -sr "templates/"{foo\@-_.+a-1.template,foo\@-_.+a.template}
+}
+IFS="" read -d '' expected_output <<'EOF'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=foo@-_.+a; version=1;
+42 cookies
+# template end;
+}
+EOF
diff --git a/test/scripts/makepkg-template-tests/template-without-version/PKGBUILD b/test/scripts/makepkg-template-tests/template-without-version/PKGBUILD
new file mode 100644
index 00000000..a4509a1a
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/template-without-version/PKGBUILD
@@ -0,0 +1,8 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=template-without_version
+make install
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/template-without-version/templates/template-without_version.template b/test/scripts/makepkg-template-tests/template-without-version/templates/template-without_version.template
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/template-without-version/templates/template-without_version.template
diff --git a/test/scripts/makepkg-template-tests/template-without-version/testcase-config b/test/scripts/makepkg-template-tests/template-without-version/testcase-config
new file mode 100644
index 00000000..ec04f2fa
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/template-without-version/testcase-config
@@ -0,0 +1,9 @@
+arguments+=()
+expected_exitcode=255
+
+IFS="" read -d '' expected_output <<'EOF'
+Couldn't detect version for template 'template-without_version'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/testcase-config-template b/test/scripts/makepkg-template-tests/testcase-config-template
new file mode 100644
index 00000000..66267d3b
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/testcase-config-template
@@ -0,0 +1,9 @@
+arguments+=()
+expected_exitcode=0
+
+# set IFS="" if you want trailing new line(s), otherwise remove it
+IFS="" read -d '' expected_output <<'EOF'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+EOF
diff --git a/test/scripts/makepkg-template-tests/update-version-with-newest-option/PKGBUILD b/test/scripts/makepkg-template-tests/update-version-with-newest-option/PKGBUILD
new file mode 100644
index 00000000..e1687cc8
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/update-version-with-newest-option/PKGBUILD
@@ -0,0 +1,7 @@
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module; version=1.0
+# template end;
+}
diff --git a/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-bla-1.2.template b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-bla-1.2.template
new file mode 100644
index 00000000..b72e7d48
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-bla-1.2.template
@@ -0,0 +1 @@
+bla bla
diff --git a/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.0.template b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.0.template
new file mode 100644
index 00000000..415025ac
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.0.template
@@ -0,0 +1,6 @@
+echo "before bla template"
+# template input; name=perl-bla
+echo "after bla template"
+perl Makefile.pl
+make
+make install
diff --git a/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.1.template b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.1.template
new file mode 100644
index 00000000..5ad32c3c
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/update-version-with-newest-option/templates/perl-module-1.1.template
@@ -0,0 +1,7 @@
+echo "perl-module version 1.1"
+echo "before bla template"
+# template input; name=perl-bla
+echo "after bla template"
+perl Makefile.pl
+make
+make install
diff --git a/test/scripts/makepkg-template-tests/update-version-with-newest-option/testcase-config b/test/scripts/makepkg-template-tests/update-version-with-newest-option/testcase-config
new file mode 100644
index 00000000..5956a0a2
--- /dev/null
+++ b/test/scripts/makepkg-template-tests/update-version-with-newest-option/testcase-config
@@ -0,0 +1,29 @@
+arguments+=(-n)
+expected_exitcode=0
+
+_setup_testcase() {
+ ln -sr "templates/"{perl-bla-1.2.template,perl-bla.template}
+ ln -sr "templates/"{perl-module-1.1.template,perl-module.template}
+}
+
+IFS="" read -d '' expected_output <<'EOF'
+EOF
+
+IFS="" read -d '' expected_result <<'EOF'
+pkgname=foo
+pkgver=1
+
+build() {
+# template start; name=perl-module; version=1.1;
+echo "perl-module version 1.1"
+echo "before bla template"
+# template start; name=perl-bla; version=1.2;
+bla bla
+# template end;
+echo "after bla template"
+perl Makefile.pl
+make
+make install
+# template end;
+}
+EOF