Merge branch 'tmp-more-cicd' into 'master'
Support both old and new bison. Closes: #33.
Closes #33
See merge request gnutls/libtasn1!79
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 56819f6..2064bc2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,7 @@
# See http://doc.gitlab.com/ce/ci/yaml/ for documentation.
x86-64:
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ stage: build
script:
- yum remove -y libtasn1-devel
- ./bootstrap
@@ -22,8 +23,70 @@
expire_in: 1 week
when: on_failure
paths:
+ - libtasn1-*.tar.gz
- ./*.log
- ./tests/*.log
+ artifacts:
+ expire_in: 1 week
+ when: on_success
+ paths:
+ - libtasn1-*.tar.gz
+
+Debian-oldstable-bootstrap:
+ image: debian:oldstable-slim
+ stage: build
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make git autoconf automake libtool bison texinfo texlive texlive-generic-recommended texlive-extra-utils help2man gtk-doc-tools valgrind abigail-tools
+ script:
+ - ./bootstrap
+ - ./configure --enable-gcc-warnings
+ - make -j$(nproc)
+ - make -j$(nproc) check
+ - make distcheck
+ artifacts:
+ expire_in: 2 weeks
+ when: on_success
+ paths:
+ - libtasn1-*.tar.gz
+
+Debian-stable-bootstrap:
+ image: debian:stable-slim
+ stage: build
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make git autoconf automake libtool bison texinfo texlive texlive-generic-recommended texlive-extra-utils help2man gtk-doc-tools valgrind abigail-tools
+ script:
+ - ./bootstrap
+ - ./configure --enable-gcc-warnings
+ - make -j$(nproc)
+ - make -j$(nproc) check
+ - make abi-check
+ - make distcheck
+ artifacts:
+ expire_in: 2 weeks
+ when: on_success
+ paths:
+ - libtasn1-*.tar.gz
+
+Debian-testing-bootstrap:
+ image: debian:testing-slim
+ stage: build
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make git autoconf automake libtool bison texinfo texlive texlive-plain-generic texlive-extra-utils help2man gtk-doc-tools valgrind abigail-tools
+ script:
+ - ./bootstrap
+ - ./configure --enable-gcc-warnings
+ - make -j$(nproc)
+ - make -j$(nproc) check
+ - make abi-check
+ - make distcheck
+ artifacts:
+ expire_in: 2 weeks
+ when: on_success
+ paths:
+ - libtasn1-*.tar.gz
valgrind/werror:
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
@@ -188,6 +251,91 @@
paths:
- scan-build-lib/
+Debian-oldstable-distcheck:
+ image: debian:oldstable-slim
+ stage: test
+ needs: [x86-64]
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make gcc gtk-doc-tools texinfo texlive texlive-generic-recommended texlive-extra-utils
+ script:
+ - tar xfa libtasn1-*.tar.gz
+ - cd `ls -d libtasn1-* | grep -v tar.gz`
+ - ./configure --enable-gcc-warnings || (cat config.log; exit 1)
+ - make distcheck V=1 || (find . -name test-suite.log -exec cat {} +; exit 1)
+ artifacts:
+ expire_in: 2 weeks
+ paths:
+ - libtasn1-*.tar.gz
+
+Debian-stable-distcheck:
+ image: debian:stable-slim
+ stage: test
+ needs: [x86-64]
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make gcc gtk-doc-tools texinfo texlive texlive-plain-generic
+ script:
+ - tar xfa libtasn1-*.tar.gz
+ - cd `ls -d libtasn1-* | grep -v tar.gz`
+ - ./configure --enable-gcc-warnings || (cat config.log; exit 1)
+ - make distcheck V=1 || (find . -name test-suite.log -exec cat {} +; exit 1)
+ artifacts:
+ expire_in: 2 weeks
+ paths:
+ - libtasn1-*.tar.gz
+
+Debian-testing-distcheck:
+ image: debian:testing-slim
+ stage: test
+ needs: [x86-64]
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make gcc gtk-doc-tools texinfo texlive texlive-plain-generic
+ script:
+ - tar xfa libtasn1-*.tar.gz
+ - cd `ls -d libtasn1-* | grep -v tar.gz`
+ - ./configure --enable-gcc-warnings || (cat config.log; exit 1)
+ - make distcheck V=1 || (find . -name test-suite.log -exec cat {} +; exit 1)
+ artifacts:
+ expire_in: 2 weeks
+ paths:
+ - libtasn1-*.tar.gz
+
+Ubuntu-latest-distcheck:
+ image: ubuntu:latest
+ stage: test
+ needs: [x86-64]
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make gcc gtk-doc-tools texinfo texlive texlive-plain-generic
+ script:
+ - tar xfa libtasn1-*.tar.gz
+ - cd `ls -d libtasn1-* | grep -v tar.gz`
+ - ./configure --enable-gcc-warnings || (cat config.log; exit 1)
+ - make distcheck V=1 || (find . -name test-suite.log -exec cat {} +; exit 1)
+ artifacts:
+ expire_in: 2 weeks
+ paths:
+ - libtasn1-*.tar.gz
+
+Ubuntu-rolling-distcheck:
+ image: ubuntu:rolling
+ stage: test
+ needs: [x86-64]
+ before_script:
+ - apt-get update -qq
+ - env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make gcc gtk-doc-tools texinfo texlive texlive-plain-generic
+ script:
+ - tar xfa libtasn1-*.tar.gz
+ - cd `ls -d libtasn1-* | grep -v tar.gz`
+ - ./configure --enable-gcc-warnings || (cat config.log; exit 1)
+ - make distcheck V=1 || (find . -name test-suite.log -exec cat {} +; exit 1)
+ artifacts:
+ expire_in: 2 weeks
+ paths:
+ - libtasn1-*.tar.gz
+
# Target to run code coverage on non-master branches. That is intended
# to ensure that compilation in master will not break the pages rule.
pages-test:
diff --git a/README.md b/README.md
index 43e2998..a3c48a8 100644
--- a/README.md
+++ b/README.md
@@ -36,13 +36,23 @@
system, and the instructions for installing them differ. Here are
some hints:
-gNewSense/Debian/Ubuntu:
+Debian/Ubuntu:
```
-sudo apt-get install make git-core autoconf automake libtool
-sudo apt-get install texinfo texlive texlive-generic-recommended texlive-extra-utils
+sudo apt-get install make git autoconf automake libtool bison
+sudo apt-get install texinfo texlive texlive-extra-utils
sudo apt-get install help2man gtk-doc-tools valgrind abigail-tools
```
+Debian <= stretch:
+```
+sudo apt-get install texlive-generic-recommended
+```
+
+Debian >= buster:
+```
+sudo apt-get install texlive-plain-generic
+```
+
The next step is to run autoreconf, ./configure, etc:
```
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index 689955a..2e7e679 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -30,12 +30,14 @@
#include <stdlib.h>
#include "libtasn1.h"
+#define MAX_ERRS 3
+
typedef struct
{
int lineNumber;
const char *line;
int errorNumber;
- const char *errorDescription;
+ const char *errorDescription[MAX_ERRS];
} test_type;
const char *fileCorrectName;
@@ -48,67 +50,67 @@
{5,
"TEST_PARSER2 { } DEFINITIONS IMPLICIT TAGS ::= BEGIN int1 ::= INTEGER END",
ASN1_SYNTAX_ERROR,
- _FILE_
- ":6: Error: syntax error, unexpected IDENTIFIER, expecting end of file near 'TEST_PARSER'"},
- {6, "TEST_PARSER { }", ASN1_SUCCESS, ""},
+ {_FILE_ ":6: Error: syntax error, unexpected IDENTIFIER, expecting end of file near 'TEST_PARSER'", /* bison >= 3.6 */
+ _FILE_ ":6: Error: syntax error, unexpected IDENTIFIER, expecting $end near 'TEST_PARSER'"}}, /* bison < 3.6 */
+ {6, "TEST_PARSER { }", ASN1_SUCCESS, {""}},
/* Test ASN1_MAX_NAME_SIZE (128) */
{12,
"a123456789012345678901234567890123456789012345678901234567890123 ::= INTEGER",
- ASN1_SUCCESS, ""},
+ ASN1_SUCCESS, {""}},
{12,
"a1234567890123456789012345678901234567890123456789012345678901234 ::= INTEGER",
ASN1_NAME_TOO_LONG,
- _FILE_ ":12: name too long (more than 64 characters)"},
+ {_FILE_ ":12: name too long (more than 64 characters)"}},
/* Test 'check identifier' function */
{12, "ident1 ::= ident2 ident2 ::= INTEGER",
- ASN1_SUCCESS, ""},
+ ASN1_SUCCESS, {""}},
{12, "ident1 ::= ident2",
- ASN1_IDENTIFIER_NOT_FOUND, _FILE_ ":: identifier 'ident2' not found"},
+ ASN1_IDENTIFIER_NOT_FOUND, {_FILE_ ":: identifier 'ident2' not found"}},
{12, "obj1 OBJECT IDENTIFIER ::= {pkix 0 5 4} "
"pkix OBJECT IDENTIFIER ::= {1 2}",
- ASN1_SUCCESS, ""},
+ ASN1_SUCCESS, {""}},
{12, "obj1 OBJECT IDENTIFIER ::= {pkix 0 5 4}",
- ASN1_IDENTIFIER_NOT_FOUND, _FILE_ ":: identifier 'pkix' not found"},
+ ASN1_IDENTIFIER_NOT_FOUND, {_FILE_ ":: identifier 'pkix' not found"}},
/* Test INTEGER */
- {14, "int1 INTEGER (-5..5),", ASN1_SUCCESS, ""},
- {14, "int1 INTEGER OPTIONAL,", ASN1_SUCCESS, ""},
- {14, "int1 INTEGER DEFAULT 1,", ASN1_SUCCESS, ""},
- {14, "int1 INTEGER DEFAULT -1,", ASN1_SUCCESS, ""},
- {14, "int1 INTEGER DEFAULT v1,", ASN1_SUCCESS, ""},
- {14, "int1 [1] INTEGER,", ASN1_SUCCESS, ""},
- {14, "int1 [1] EXPLICIT INTEGER,", ASN1_SUCCESS, ""},
- {14, "int1 [1] IMPLICIT INTEGER,", ASN1_SUCCESS, ""},
- {12, "Integer ::= [1] EXPLICIT INTEGER {v1(-1), v2(1)}", ASN1_SUCCESS, ""},
+ {14, "int1 INTEGER (-5..5),", ASN1_SUCCESS, {""}},
+ {14, "int1 INTEGER OPTIONAL,", ASN1_SUCCESS, {""}},
+ {14, "int1 INTEGER DEFAULT 1,", ASN1_SUCCESS, {""}},
+ {14, "int1 INTEGER DEFAULT -1,", ASN1_SUCCESS, {""}},
+ {14, "int1 INTEGER DEFAULT v1,", ASN1_SUCCESS, {""}},
+ {14, "int1 [1] INTEGER,", ASN1_SUCCESS, {""}},
+ {14, "int1 [1] EXPLICIT INTEGER,", ASN1_SUCCESS, {""}},
+ {14, "int1 [1] IMPLICIT INTEGER,", ASN1_SUCCESS, {""}},
+ {12, "Integer ::= [1] EXPLICIT INTEGER {v1(-1), v2(1)}", ASN1_SUCCESS, {""}},
{12, "Integer ::= INTEGER {v1(0), v2}", ASN1_SYNTAX_ERROR,
- _FILE_ ":12: Error: syntax error, unexpected '}', expecting '(' near '}'"},
+ {_FILE_ ":12: Error: syntax error, unexpected '}', expecting '(' near '}'"}},
{12, "Integer ::= INTEGER {v1(0), 1}",
ASN1_SYNTAX_ERROR,
- _FILE_
- ":12: Error: syntax error, unexpected NUM, expecting IDENTIFIER or '(' near '1'"},
- {12, "const1 INTEGER ::= -1", ASN1_SUCCESS, ""},
- {12, "const1 INTEGER ::= 1", ASN1_SUCCESS, ""},
+ {_FILE_
+ ":12: Error: syntax error, unexpected NUM, expecting IDENTIFIER or '(' near '1'"}},
+ {12, "const1 INTEGER ::= -1", ASN1_SUCCESS, {""}},
+ {12, "const1 INTEGER ::= 1", ASN1_SUCCESS, {""}},
{12, "const1 INTEGER ::= v1",
ASN1_SYNTAX_ERROR,
- _FILE_
- ":12: Error: syntax error, unexpected IDENTIFIER, expecting NUM or '+' or '-' near 'v1'"},
+ {_FILE_
+ ":12: Error: syntax error, unexpected IDENTIFIER, expecting NUM or '+' or '-' near 'v1'"}},
{16, " generic generalstring",
ASN1_IDENTIFIER_NOT_FOUND,
- _FILE_ ":: identifier 'generalstring' not found"},
+ {_FILE_ ":: identifier 'generalstring' not found"}},
/* Test: OID */
{20, " oid1 OBJECT IDENTIFIER DEFAULT Oid-type",
- ASN1_IDENTIFIER_NOT_FOUND, _FILE_ ":: identifier 'Oid-type' not found"},
+ ASN1_IDENTIFIER_NOT_FOUND, {_FILE_ ":: identifier 'Oid-type' not found"}},
{20, " oid1 OBJECT IDENTIFIER DEFAULT 1",
- ASN1_IDENTIFIER_NOT_FOUND, _FILE_ ":: identifier '1' not found"},
+ ASN1_IDENTIFIER_NOT_FOUND, {_FILE_ ":: identifier '1' not found"}},
{20, " oid1 OBJECT IDENTIFIER DEFAULT",
ASN1_SYNTAX_ERROR,
- _FILE_ ":21: Error: syntax error, unexpected '}' near '}'"},
+ {_FILE_ ":21: Error: syntax error, unexpected '}' near '}'"}},
{20, " oid1 OBJECT IDENTIFIER DEFAULT Oid-type1",
- ASN1_SUCCESS, ""},
+ ASN1_SUCCESS, {""}},
{22, "KeyUsage ::= BIT STRING { xxx (0), enring UTF8String (SIZE (1..200)) }",
- ASN1_SYNTAX_ERROR, _FILE_":22: Error: syntax error, unexpected UTF8String, expecting '(' near 'UTF8String'"},
+ ASN1_SYNTAX_ERROR, {_FILE_":22: Error: syntax error, unexpected UTF8String, expecting '(' near 'UTF8String'"}},
/* end */
{0}
@@ -153,6 +155,14 @@
fclose (fileIn);
}
+static int
+errorStrcmp (const char *needle, const char **haystack)
+{
+ for (; haystack && *haystack; haystack++)
+ if (strcmp (needle, *haystack) == 0)
+ return 0;
+ return 1;
+}
int
main (int argc, char *argv[])
@@ -209,13 +219,13 @@
asn1_delete_structure (&definitions);
if ((result != test->errorNumber) ||
- (strcmp (errorDescription, test->errorDescription)))
+ (errorStrcmp (errorDescription, test->errorDescription)))
{
errorCounter++;
printf ("ERROR N. %d:\n", errorCounter);
printf (" Line %d - %s\n", test->lineNumber, test->line);
printf (" Error expected: %s - %s\n",
- asn1_strerror (test->errorNumber), test->errorDescription);
+ asn1_strerror (test->errorNumber), *test->errorDescription);
printf (" Error detected: %s - %s\n\n", asn1_strerror (result),
errorDescription);
exit (1);