Blame SOURCES/0195-testsuite-problem_data-add-problem_data_reproducible.patch

28bab8
From d036dce0c804a6d91790dd8e6aa4f2ca08e703d9 Mon Sep 17 00:00:00 2001
28bab8
From: Matej Habrnal <mhabrnal@redhat.com>
28bab8
Date: Tue, 29 Mar 2016 12:11:23 +0200
28bab8
Subject: [PATCH] testsuite: problem_data: add problem_data_reproducible
28bab8
 testcase
28bab8
28bab8
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
28bab8
---
28bab8
 tests/problem_data.at | 415 ++++++++++++++++++++++++++++++++++++++++++++++++++
28bab8
 1 file changed, 415 insertions(+)
28bab8
 create mode 100644 tests/problem_data.at
28bab8
28bab8
diff --git a/tests/problem_data.at b/tests/problem_data.at
28bab8
new file mode 100644
28bab8
index 0000000..c4ee4de
28bab8
--- /dev/null
28bab8
+++ b/tests/problem_data.at
28bab8
@@ -0,0 +1,415 @@
28bab8
+# -*- Autotest -*-
28bab8
+
28bab8
+AT_BANNER([problem data])
28bab8
+
28bab8
+## ---------------- ##
28bab8
+## problem_data_add ##
28bab8
+## ---------------- ##
28bab8
+
28bab8
+AT_TESTFUN([problem_data_add],
28bab8
+[[
28bab8
+#include "problem_data.h"
28bab8
+#include "internal_libreport.h"
28bab8
+#include <assert.h>
28bab8
+
28bab8
+#define TEST_NAME "package"
28bab8
+#define TEST_CONTENTS "libreport"
28bab8
+#define TEST_FLAGS (CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE | CD_FLAG_UNIXTIME)
28bab8
+
28bab8
+int main(int argc, char **argv)
28bab8
+{
28bab8
+    g_verbose = 3;
28bab8
+
28bab8
+    problem_data_t *data = problem_data_new();
28bab8
+    problem_data_add(data, TEST_NAME, TEST_CONTENTS, TEST_FLAGS);
28bab8
+
28bab8
+    struct problem_item *itm = problem_data_get_item_or_NULL(data, TEST_NAME);
28bab8
+
28bab8
+    assert(strcmp(itm->content, TEST_CONTENTS) == 0);
28bab8
+    assert(itm->flags == TEST_FLAGS);
28bab8
+    assert(itm->size == PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+
28bab8
+    problem_data_free(data);
28bab8
+
28bab8
+    return 0;
28bab8
+}
28bab8
+]])
28bab8
+
28bab8
+## -------------------- ##
28bab8
+## problem_data_add_ext ##
28bab8
+## -------------------- ##
28bab8
+
28bab8
+AT_TESTFUN([problem_data_add_ext],
28bab8
+[[
28bab8
+#include "problem_data.h"
28bab8
+#include "internal_libreport.h"
28bab8
+#include <assert.h>
28bab8
+
28bab8
+#define TEST_NAME "package"
28bab8
+#define TEST_CONTENTS "libreport"
28bab8
+#define TEST_FLAGS (CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE | CD_FLAG_UNIXTIME)
28bab8
+
28bab8
+int main(int argc, char **argv)
28bab8
+{
28bab8
+    g_verbose = 3;
28bab8
+
28bab8
+    problem_data_t *data = problem_data_new();
28bab8
+    struct problem_item *itm = problem_data_add_ext(data, TEST_NAME, TEST_CONTENTS, TEST_FLAGS, strlen(TEST_CONTENTS));
28bab8
+
28bab8
+    struct problem_item *found = problem_data_get_item_or_NULL(data, TEST_NAME);
28bab8
+    assert(itm == found);
28bab8
+
28bab8
+    assert(strcmp(itm->content, TEST_CONTENTS) == 0);
28bab8
+    assert(itm->flags == TEST_FLAGS);
28bab8
+    assert(itm->size == strlen(TEST_CONTENTS));
28bab8
+
28bab8
+    problem_data_free(data);
28bab8
+
28bab8
+    return 0;
28bab8
+}
28bab8
+]])
28bab8
+
28bab8
+## ---------------------- ##
28bab8
+## problem_item_get_size ##
28bab8
+## ---------------------- ##
28bab8
+
28bab8
+AT_TESTFUN([problem_item_get_size],
28bab8
+[[
28bab8
+#include "problem_data.h"
28bab8
+#include "internal_libreport.h"
28bab8
+#include <assert.h>
28bab8
+
28bab8
+int main(int argc, char **argv)
28bab8
+{
28bab8
+    g_verbose = 3;
28bab8
+
28bab8
+    problem_data_t *data = problem_data_new();
28bab8
+
28bab8
+    {
28bab8
+        struct problem_item *itm = problem_data_add_ext(data, "1", "foo", CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE, PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+        const size_t old_size = strlen(itm->content);
28bab8
+        {
28bab8
+            size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE;
28bab8
+            assert(problem_item_get_size(itm, &current_size) == 0);
28bab8
+            assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+            assert(current_size == old_size);
28bab8
+        }
28bab8
+        {
28bab8
+            free(itm->content);
28bab8
+            itm->content = NULL;
28bab8
+            size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE;
28bab8
+            assert(problem_item_get_size(itm, &current_size) == 0);
28bab8
+            assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+            assert(current_size == old_size);
28bab8
+        }
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char flnm[] = "/tmp/libreport.unittest.XXXXXXX";
28bab8
+        int flds = mkstemp(flnm);
28bab8
+        assert(flds >= 0);
28bab8
+        /* sizeof(flnm) is strlen + '\0' */
28bab8
+        assert(write(flds, flnm, strlen(flnm)) == strlen(flnm));
28bab8
+        fsync(flds);
28bab8
+
28bab8
+        struct stat buf;
28bab8
+        assert(fstat(flds, &buf) == 0);
28bab8
+        assert(buf.st_size != 0);
28bab8
+        size_t old_size = buf.st_size;
28bab8
+
28bab8
+        struct problem_item *itm = problem_data_add_ext(data, "2", flnm, CD_FLAG_BIN, PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+
28bab8
+        {
28bab8
+            size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE;
28bab8
+            assert(problem_item_get_size(itm, &current_size) == 0);
28bab8
+            assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+            assert(current_size == old_size);
28bab8
+        }
28bab8
+        {
28bab8
+            close(flds);
28bab8
+            unlink(flnm);
28bab8
+            assert(stat(flnm, &buf) != 0);
28bab8
+            size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE;
28bab8
+            assert(problem_item_get_size(itm, &current_size) == 0);
28bab8
+            assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE);
28bab8
+            assert(current_size == old_size);
28bab8
+        }
28bab8
+    }
28bab8
+
28bab8
+    problem_data_free(data);
28bab8
+
28bab8
+    return 0;
28bab8
+}
28bab8
+]])
28bab8
+
28bab8
+## ------------------------------- ##
28bab8
+## problem_data_load_from_dump_dir ##
28bab8
+## ------------------------------- ##
28bab8
+
28bab8
+AT_TESTFUN([problem_data_load_from_dump_dir],
28bab8
+[[
28bab8
+#include "problem_data.h"
28bab8
+#include "internal_libreport.h"
28bab8
+#include <assert.h>
28bab8
+
28bab8
+int main(int argc, char **argv)
28bab8
+{
28bab8
+    g_verbose = 3;
28bab8
+
28bab8
+    char template[] = "/tmp/XXXXXX";
28bab8
+
28bab8
+    if (mkdtemp(template) == NULL) {
28bab8
+        perror("mkdtemp()");
28bab8
+        return EXIT_FAILURE;
28bab8
+    }
28bab8
+
28bab8
+    printf("Dump dir path: %s\n", template);
28bab8
+
28bab8
+    struct dump_dir *dd = dd_create(template, (uid_t)-1, 0640);
28bab8
+    assert(dd != NULL || !"Cannot create new dump directory");
28bab8
+
28bab8
+    /* dd_create_basic_files() should create these files:
28bab8
+       FILENAME_TIME, FILENAME_LAST_OCCURRENCE, FILENAME_UID, FILENAME_KERNEL,
28bab8
+       FILENAME_ARCHITECTURE, FILENAME_HOSTNAME, FILENAME_OS_INFO, FILENAME_OS_RELEASE
28bab8
+     */
28bab8
+    dd_create_basic_files(dd, geteuid(), NULL);
28bab8
+
28bab8
+    dd_save_text(dd, FILENAME_TYPE, "attest");
28bab8
+    dd_save_text(dd, FILENAME_ANALYZER, "attest-problem_data");
28bab8
+    dd_save_text(dd, FILENAME_DUPHASH, "0123456789ABCDEF");
28bab8
+    dd_save_text(dd, FILENAME_UUID, "FEDCBA9876543210");
28bab8
+    dd_save_text(dd, FILENAME_USERNAME, "perhaps_tester");
28bab8
+    dd_save_text(dd, FILENAME_PACKAGE, "1:attest-1.1-3.x86_64");
28bab8
+    dd_save_text(dd, FILENAME_PKG_EPOCH, "1");
28bab8
+    dd_save_text(dd, FILENAME_PKG_NAME, "attest");
28bab8
+    dd_save_text(dd, FILENAME_PKG_VERSION, "1.1");
28bab8
+    dd_save_text(dd, FILENAME_PKG_RELEASE, "3");
28bab8
+    dd_save_text(dd, FILENAME_PKG_ARCH, "x86_64");
28bab8
+    dd_save_text(dd, FILENAME_CMDLINE, "$TESTSUITE.DIR/$NUM/problem_data_load_from_dump_dir foo blah");
28bab8
+    dd_save_text(dd, FILENAME_EXECUTABLE, "$TESTSUITE.DIR/$NUM/problem_data_load_from_dump_dir");
28bab8
+    dd_save_text(dd, FILENAME_ROOTDIR, "/");
28bab8
+    dd_save_text(dd, FILENAME_PWD, "$TESTSUITE.DIR");
28bab8
+    dd_save_text(dd, FILENAME_PID, "12345");
28bab8
+    dd_save_text(dd, FILENAME_GLOBAL_PID, "12345");
28bab8
+    dd_save_text(dd, FILENAME_TID, "12345");
28bab8
+    dd_save_text(dd, FILENAME_COUNT, "1");
28bab8
+    dd_save_text(dd, FILENAME_REASON, "Unit testing problem_data_load_from_dump_dir");
28bab8
+    dd_save_text(dd, FILENAME_COMMENT, "Random comment");
28bab8
+    dd_save_text(dd, FILENAME_BACKTRACE, "Pseudo-backtrace");
28bab8
+    dd_save_text(dd, FILENAME_OPEN_FDS, "Opened FDs");
28bab8
+    dd_save_text(dd, FILENAME_MAPS, "/proc/[pid]/maps");
28bab8
+    dd_save_text(dd, FILENAME_SMAPS, "/proc/[pid]/smaps");
28bab8
+    dd_save_text(dd, FILENAME_ENVIRON, "/proc/[pid]/environ");
28bab8
+    dd_save_text(dd, FILENAME_LIMITS, "/proc/[pid]/limits");
28bab8
+    dd_save_text(dd, FILENAME_CGROUP, "/proc/[pid]/cgroup");
28bab8
+    dd_save_text(dd, FILENAME_PROC_PID_STATUS, "/proc/[pid]/status");
28bab8
+    dd_save_text(dd, FILENAME_MOUNTINFO, "/proc/[pid]/mountinfo");
28bab8
+    dd_save_text(dd, FILENAME_CRASH_FUNCTION, "main");
28bab8
+    dd_save_text(dd, FILENAME_REMOTE, "0");
28bab8
+    dd_save_text(dd, FILENAME_RATING, "4");
28bab8
+    dd_save_text(dd, FILENAME_EXPLOITABLE, "6");
28bab8
+    dd_save_text(dd, FILENAME_TAINTED, "Not tainted");
28bab8
+    dd_save_text(dd, FILENAME_TAINTED_SHORT, "Not tainted");
28bab8
+    dd_save_text(dd, FILENAME_TAINTED_LONG, "Not tainted");
28bab8
+    dd_save_text(dd, FILENAME_NOT_REPORTABLE, "Despite 'not tainted' this problem cannot be reported.");
28bab8
+    dd_save_text(dd, FILENAME_REPORTED_TO, "Bugzilla: URL=https://bugzilla.redhat.com/1000000");
28bab8
+    dd_save_text(dd, FILENAME_EVENT_LOG, "--- report_Bugzilla has finished successfully ---");
28bab8
+    dd_save_text(dd, FILENAME_KICKSTART_CFG, "kickstart.cfg");
28bab8
+    dd_save_text(dd, FILENAME_ANACONDA_TB, "anaconda.tb");
28bab8
+
28bab8
+    dd_save_text(dd, FILENAME_NAMESPACES, "FILENAME_NAMESPACES");
28bab8
+    dd_save_text(dd, FILENAME_OS_INFO_IN_ROOTDIR, "FILENAME_OS_INFO_IN_ROOTDIR");
28bab8
+    dd_save_text(dd, FILENAME_OS_RELEASE_IN_ROOTDIR, "FILENAME_OS_RELEASE_IN_ROOTDIR");
28bab8
+    dd_save_text(dd, FILENAME_KERNEL_LOG, "FILENAME_KERNEL_LOG");
28bab8
+    dd_save_text(dd, FILENAME_DESCRIPTION, "FILENAME_DESCRIPTION");
28bab8
+    dd_save_text(dd, FILENAME_CORE_BACKTRACE, "FILENAME_CORE_BACKTRACE");
28bab8
+    dd_save_text(dd, FILENAME_REMOTE_RESULT, "FILENAME_REMOTE_RESULT");
28bab8
+    dd_save_text(dd, FILENAME_ABRT_VERSION, "FILENAME_ABRT_VERSION");
28bab8
+    dd_save_text(dd, FILENAME_CONTAINER, "FILENAME_CONTAINER");
28bab8
+    dd_save_text(dd, FILENAME_CONTAINER_ID, "FILENAME_CONTAINER_ID");
28bab8
+    dd_save_text(dd, FILENAME_CONTAINER_UUID, "FILENAME_CONTAINER_UUID");
28bab8
+    dd_save_text(dd, FILENAME_CONTAINER_IMAGE, "FILENAME_CONTAINER_IMAGE");
28bab8
+    dd_save_text(dd, FILENAME_CONTAINER_CMDLINE, "FILENAME_CONTAINER_CMDLINE");
28bab8
+    dd_save_text(dd, FILENAME_DOCKER_INSPECT, "FILENAME_DOCKER_INSPECT");
28bab8
+
28bab8
+    dd_save_text(dd, "attestsuite-random-file", "random content");
28bab8
+    dd_save_text(dd, "attestsuite-oneliner-newline", "newline\n");
28bab8
+    dd_save_text(dd, "attestsuite-newline-followed", "newline\nfollowed");
28bab8
+    dd_save_text(dd, "attestsuite-multi-line", "newline\nextra\n");
28bab8
+    dd_save_text(dd, "attestsuite-tab", "tab\ttab");
28bab8
+    dd_save_text(dd, "attestsuite-cr", "cr\rcr");
28bab8
+
28bab8
+    char buffer[1024*3];
28bab8
+    memset(buffer, 'x', sizeof(buffer));
28bab8
+
28bab8
+    {
28bab8
+        int fd4k = openat(dd->dd_fd, "attestsuite-over4k", O_WRONLY | O_CREAT | O_TRUNC, 0550);
28bab8
+        assert(fd4k >= 0);
28bab8
+        full_write(fd4k, buffer, sizeof(buffer));
28bab8
+        full_write(fd4k, buffer, sizeof(buffer));
28bab8
+        close(fd4k);
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        int bigfd = openat(dd->dd_fd, "attestsuite-bigtext", O_WRONLY | O_CREAT | O_TRUNC, 0550);
28bab8
+        assert(bigfd >= 0);
28bab8
+        for (int i = 3000; i > 0; --i)
28bab8
+            full_write(bigfd, buffer, sizeof(buffer));
28bab8
+        close(bigfd);
28bab8
+    }
28bab8
+
28bab8
+    dd_copy_file(dd, FILENAME_BINARY, "/usr/bin/sh");
28bab8
+    dd_copy_file(dd, FILENAME_COREDUMP, "/usr/bin/sh");
28bab8
+    dd_copy_file(dd, FILENAME_VMCORE, "/usr/bin/sh");
28bab8
+
28bab8
+    static const char *const list_elements[] = { FILENAME_UID, FILENAME_PACKAGE,
28bab8
+        FILENAME_CMDLINE, FILENAME_TIME, FILENAME_COUNT, FILENAME_REASON };
28bab8
+
28bab8
+    static const char *const editable_files[] = { FILENAME_COMMENT, FILENAME_BACKTRACE,
28bab8
+        FILENAME_REASON, FILENAME_OPEN_FDS, FILENAME_CMDLINE, FILENAME_MAPS,
28bab8
+        FILENAME_SMAPS, FILENAME_ENVIRON, FILENAME_HOSTNAME, FILENAME_REMOTE,
28bab8
+        FILENAME_KICKSTART_CFG, FILENAME_ANACONDA_TB, };
28bab8
+
28bab8
+    static const char *const binary_files[] = { FILENAME_BINARY, FILENAME_COREDUMP,
28bab8
+        FILENAME_VMCORE, };
28bab8
+
28bab8
+    problem_data_t *pd = problem_data_new();
28bab8
+    problem_data_load_from_dump_dir(pd, dd, /*excluding*/NULL);
28bab8
+
28bab8
+    GHashTableIter pd_iter;
28bab8
+    char *element_name;
28bab8
+    struct problem_item *item;
28bab8
+    g_hash_table_iter_init(&pd_iter, pd);
28bab8
+    while (g_hash_table_iter_next(&pd_iter, (void**)&element_name, (void**)&item))
28bab8
+    {
28bab8
+        printf("Testing element : %s\n", element_name);
28bab8
+
28bab8
+        size_t i;
28bab8
+        for (i = 0; i < ARRAY_SIZE(list_elements); ++i)
28bab8
+        {
28bab8
+            if (strcmp(element_name, list_elements[i]) == 0)
28bab8
+            {
28bab8
+                assert((item->flags & CD_FLAG_LIST));
28bab8
+                break;
28bab8
+            }
28bab8
+        }
28bab8
+        if (i == ARRAY_SIZE(list_elements))
28bab8
+            assert(!(item->flags & CD_FLAG_LIST));
28bab8
+
28bab8
+        for (i = 0; i < ARRAY_SIZE(editable_files); ++i)
28bab8
+        {
28bab8
+            if (strcmp(element_name, editable_files[i]) == 0)
28bab8
+            {
28bab8
+                assert((item->flags & CD_FLAG_ISEDITABLE) && !(item->flags & CD_FLAG_ISNOTEDITABLE));
28bab8
+                break;
28bab8
+            }
28bab8
+        }
28bab8
+        if (i == ARRAY_SIZE(editable_files))
28bab8
+            assert(!(item->flags & CD_FLAG_ISEDITABLE) && (item->flags & CD_FLAG_ISNOTEDITABLE));
28bab8
+
28bab8
+        for (i = 0; i < ARRAY_SIZE(binary_files); ++i)
28bab8
+        {
28bab8
+            if (strcmp(element_name, binary_files[i]) == 0)
28bab8
+            {
28bab8
+                assert((item->flags & CD_FLAG_BIN) && !(item->flags & CD_FLAG_TXT) && !(item->flags & CD_FLAG_BIGTXT));
28bab8
+                break;
28bab8
+            }
28bab8
+        }
28bab8
+        if (i == ARRAY_SIZE(binary_files))
28bab8
+        {
28bab8
+            if(strstr(element_name, "bigtext") == 0)
28bab8
+                assert((item->flags & CD_FLAG_TXT) && !(item->flags & CD_FLAG_BIN) && !(item->flags & CD_FLAG_BIGTXT));
28bab8
+            else
28bab8
+                assert((item->flags & CD_FLAG_BIGTXT) && (item->flags & CD_FLAG_BIN) && !(item->flags & CD_FLAG_TXT));
28bab8
+        }
28bab8
+
28bab8
+        if (strcmp(element_name, FILENAME_TIME) == 0)
28bab8
+            assert(item->flags & CD_FLAG_UNIXTIME);
28bab8
+        else
28bab8
+            assert(!(item->flags & CD_FLAG_UNIXTIME));
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-oneliner-newline");
28bab8
+        assert(cnt != NULL && "attestsuite-oneliner-newline");
28bab8
+        assert(strcmp(cnt, "newline") == 0);
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-newline-followed");
28bab8
+        assert(cnt != NULL && "attestsuite-newline-followed");
28bab8
+        assert(strcmp(cnt, "newline\nfollowed") == 0);
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-multi-line");
28bab8
+        assert(cnt != NULL && "attestsuite-multi-line");
28bab8
+        assert(strcmp(cnt, "newline\nextra\n") == 0);
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-over4k");
28bab8
+        assert(cnt != NULL && "attestsuite-over4k");
28bab8
+        assert(strlen(cnt) == (2 * sizeof(buffer)));
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-tab");
28bab8
+        assert(cnt != NULL && "attestsuite-tab");
28bab8
+        assert(strcmp(cnt, "tab\ttab") == 0);
28bab8
+    }
28bab8
+
28bab8
+    {
28bab8
+        char *cnt = problem_data_get_content_or_NULL(pd, "attestsuite-cr");
28bab8
+        assert(cnt != NULL && "attestsuite-cr");
28bab8
+        assert(strcmp(cnt, "cr[0D]cr") == 0);
28bab8
+    }
28bab8
+
28bab8
+    return 0;
28bab8
+}
28bab8
+]])
28bab8
+
28bab8
+## ------------------------- ##
28bab8
+## problem_data_reproducible ##
28bab8
+## ------------------------- ##
28bab8
+
28bab8
+AT_TESTFUN([problem_data_reproducible],
28bab8
+[[
28bab8
+#include "testsuite.h"
28bab8
+
28bab8
+#define TEST_FLAGS (CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE | CD_FLAG_UNIXTIME)
28bab8
+
28bab8
+TS_MAIN
28bab8
+{
28bab8
+    TS_ASSERT_STRING_NULL_OR_EMPTY(get_problem_data_reproducible_name(-1), "Invalid value");
28bab8
+    TS_ASSERT_PTR_IS_NOT_NULL(get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_UNKNOWN));
28bab8
+    TS_ASSERT_PTR_IS_NOT_NULL(get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_YES));
28bab8
+    TS_ASSERT_PTR_IS_NOT_NULL(get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_RECURRENT));
28bab8
+    TS_ASSERT_STRING_NULL_OR_EMPTY(get_problem_data_reproducible_name(_PROBLEM_REPRODUCIBLE_MAX_), "Upper boundary");
28bab8
+    TS_ASSERT_STRING_NULL_OR_EMPTY(get_problem_data_reproducible_name(_PROBLEM_REPRODUCIBLE_MAX_ + 1), "Upper boundary + 1");
28bab8
+    TS_ASSERT_SIGNED_EQ(_PROBLEM_REPRODUCIBLE_MAX_, 3);
28bab8
+
28bab8
+    problem_data_t *pd = problem_data_new();
28bab8
+
28bab8
+    TS_ASSERT_SIGNED_EQ(get_problem_data_reproducible(pd), -1);
28bab8
+
28bab8
+    problem_data_add(pd, FILENAME_REPRODUCIBLE,
28bab8
+                     get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_UNKNOWN), TEST_FLAGS);
28bab8
+    TS_ASSERT_SIGNED_EQ(get_problem_data_reproducible(pd), PROBLEM_REPRODUCIBLE_UNKNOWN);
28bab8
+
28bab8
+    problem_data_add(pd, FILENAME_REPRODUCIBLE,
28bab8
+                     get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_YES), TEST_FLAGS);
28bab8
+    TS_ASSERT_SIGNED_EQ(get_problem_data_reproducible(pd), PROBLEM_REPRODUCIBLE_YES);
28bab8
+
28bab8
+    problem_data_add(pd, FILENAME_REPRODUCIBLE,
28bab8
+                     get_problem_data_reproducible_name(PROBLEM_REPRODUCIBLE_RECURRENT), TEST_FLAGS);
28bab8
+    TS_ASSERT_SIGNED_EQ(get_problem_data_reproducible(pd), PROBLEM_REPRODUCIBLE_RECURRENT);
28bab8
+
28bab8
+    problem_data_add(pd, FILENAME_REPRODUCIBLE,
28bab8
+                     get_problem_data_reproducible_name(_PROBLEM_REPRODUCIBLE_MAX_), TEST_FLAGS);
28bab8
+    TS_ASSERT_SIGNED_EQ(get_problem_data_reproducible(pd), -1);
28bab8
+
28bab8
+    problem_data_free(pd);
28bab8
+}
28bab8
+TS_RETURN_MAIN
28bab8
+]])
28bab8
-- 
28bab8
1.8.3.1
28bab8