add asn1c compile smoke test
diff --git a/.gitignore b/.gitignore
index 306fcf8..34af5cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,14 @@
 /skeletons/check-*
 
 # /tests/
+/tests/tests-asn1c-smoke/Makefile.am.libasncodec
+/tests/tests-asn1c-smoke/Makefile.am.sample
+/tests/tests-asn1c-smoke/*.[acho]
+/tests/tests-asn1c-smoke/*.asn
+/tests/tests-asn1c-smoke/*.txt
+/tests/tests-asn1c-smoke/converter-example
+
+# /tests/
 /tests/tests-c-compiler/test-*
 
 # /tests/tests-skeletons
diff --git a/configure.ac b/configure.ac
index 2df1580..b0e5ffd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,6 +288,7 @@
 AC_CONFIG_FILES([\
 tests/tests-c-compiler/check-src/Makefile   \
 tests/tests-asn1c-compiler/Makefile         \
+tests/tests-asn1c-smoke/Makefile            \
 tests/tests-randomized/Makefile             \
 tests/tests-c-compiler/Makefile             \
 tests/tests-skeletons/Makefile              \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7403216..d134272 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,9 @@
 
+# Tests are ordered in the rough order of the time it takes to go through them.
 SUBDIRS = \
     tests-asn1c-compiler    \
     tests-skeletons         \
+    tests-asn1c-smoke       \
     tests-c-compiler        \
     tests-randomized
 
diff --git a/tests/README b/tests/README
index 8f11f17..7e9b97c 100644
--- a/tests/README
+++ b/tests/README
@@ -1,6 +1,6 @@
-
-tests-asn1c-compiler    - tests behavior of asn1c compiler, textually
-tests-c-compiler        - attempts to compile C results of asn1c output
-tests-skeletons         - verify correctness of "skeletons" code
-tests-randomized        - thorough testing of DER/OER/PER/XER with fuzzing
+tests-asn1c-compiler - asn1c produces expected textual output
+tests-asn1c-smoke    - asn1c compiler produces compilable code for simple types
+tests-c-compiler     - C code compiles and runs, and produces expected result
+tests-skeletons      - "skeletons" code primitives are correct
+tests-randomized     - fuzz-testing of DER/OER/PER/XER codecs
 
diff --git a/tests/tests-asn1c-smoke/Makefile.am b/tests/tests-asn1c-smoke/Makefile.am
new file mode 100644
index 0000000..eae3322
--- /dev/null
+++ b/tests/tests-asn1c-smoke/Makefile.am
@@ -0,0 +1,9 @@
+
+dist_check_SCRIPTS = check-asn1c-smoke.sh
+TESTS_ENVIRONMENT= MAKE=${MAKE}                     \
+                    top_builddir=${top_builddir}    \
+                    top_srcdir=${top_srcdir}
+TESTS = $(dist_check_SCRIPTS)
+CLEANFILES = Makefile.am.* test* *.[acho]
+
+EXTRA_DIST = README
diff --git a/tests/tests-asn1c-smoke/README b/tests/tests-asn1c-smoke/README
new file mode 100644
index 0000000..57467e3
--- /dev/null
+++ b/tests/tests-asn1c-smoke/README
@@ -0,0 +1,2 @@
+Test that asn1c compiler produces compilable code for basic ASN.1 types,
+while trying to disable different codecs and vary other compiler flags.
diff --git a/tests/tests-asn1c-smoke/check-asn1c-smoke.sh b/tests/tests-asn1c-smoke/check-asn1c-smoke.sh
new file mode 100755
index 0000000..d909af2
--- /dev/null
+++ b/tests/tests-asn1c-smoke/check-asn1c-smoke.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+
+set -x
+set -e
+set -o pipefail
+
+top_builddir=${top_builddir:-../..}
+top_srcdir=${top_srcdir:-../..}
+
+cleanup() {
+    rm -rf *.[cho] Makefile.am.* *.txt *.asn
+    rm -f converter-example
+}
+
+print_state() {
+    local err=$?
+    set +x
+    set +e
+    trap "" EXIT ERR
+    echo "Error $err while processing:"
+    cat test.asn
+    cat status.txt
+    echo "FAILED"
+    exit $err
+}
+
+verify() {
+    local type="$1"
+    local flags="$2"
+
+    cleanup
+
+    asncmd="${top_builddir}/asn1c/asn1c -flink-skeletons -S ${top_srcdir}/skeletons $flags test.asn"
+
+    {
+    echo "$asncmd"
+    echo "${MAKE:-make} -f Makefile.am.example"
+    } > status.txt
+
+    echo "Module DEFINITIONS::=BEGIN T::=$type END" > test.asn
+    $asncmd
+    CFLAGS=-O0 ${MAKE:-make} -f Makefile.am.example | tail -10
+}
+
+verify_type_with_variants() {
+    local type="$1"
+    for flags in "-no-gen-PER" "-no-gen-OER" "-no-gen-PER -no-gen-OER" ""; do
+        for native in "" "-fwide-types"; do
+            verify "$type" "$flags $native"
+        done
+    done
+}
+
+verify_compile_and_link_variants() {
+    for type in INTEGER "ENUMERATED{foo}" NULL BOOLEAN "BIT STRING" \
+                "OBJECT IDENTIFIER" "RELATIVE-OID" "SEQUENCE{f INTEGER}" \
+                "CHOICE{f INTEGER}" "OCTET STRING" IA5String UTF8String \
+                REAL "SET OF INTEGER" "SEQUENCE OF INTEGER"; do
+        verify_type_with_variants "$type"
+
+    done
+}
+
+trap print_state EXIT ERR
+if [ "x$*" = "x" ]; then
+    verify_compile_and_link_variants
+else
+    for type in "$@"; do
+        verify_type_with_variants "$type"
+    done
+fi
+trap '' EXIT ERR
+
+cleanup