libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

test_rpm.c (7744B)


      1 /*
      2      This file is part of libextractor.
      3      Copyright (C) 2012 Vidyut Samanta and Christian Grothoff
      4 
      5      libextractor is free software; you can redistribute it and/or modify
      6      it under the terms of the GNU General Public License as published
      7      by the Free Software Foundation; either version 3, or (at your
      8      option) any later version.
      9 
     10      libextractor is distributed in the hope that it will be useful, but
     11      WITHOUT ANY WARRANTY; without even the implied warranty of
     12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13      General Public License for more details.
     14 
     15      You should have received a copy of the GNU General Public License
     16      along with libextractor; see the file COPYING.  If not, write to the
     17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18      Boston, MA 02110-1301, USA.
     19 */
     20 /**
     21  * @file plugins/test_rpm.c
     22  * @brief testcase for ogg plugin
     23  * @author Christian Grothoff
     24  */
     25 #include "platform.h"
     26 #include "test_lib.h"
     27 
     28 
     29 /**
     30  * Expected package summary text.
     31  */
     32 #define SUMMARY "The GNU libtool, which simplifies the use of shared libraries."
     33 
     34 /**
     35  * Expected package description text.
     36  */
     37 #define DESCRIPTION \
     38   "The libtool package contains the GNU libtool, a set of shell scripts\n" \
     39   "which automatically configure UNIX and UNIX-like architectures to\n" \
     40   "generically build shared libraries.  Libtool provides a consistent,\n" \
     41   "portable interface which simplifies the process of using shared\n" \
     42   "libraries.\n"              \
     43   "\n"                  \
     44   "If you are developing programs which will use shared libraries, you\n" \
     45   "should install libtool."
     46 
     47 
     48 /**
     49  * Main function for the RPM testcase.
     50  *
     51  * @param argc number of arguments (ignored)
     52  * @param argv arguments (ignored)
     53  * @return 0 on success
     54  */
     55 int
     56 main (int argc, char *argv[])
     57 {
     58   struct SolutionData rpm_test_sol[] = {
     59     {
     60       EXTRACTOR_METATYPE_MIMETYPE,
     61       EXTRACTOR_METAFORMAT_UTF8,
     62       "text/plain",
     63       "application/x-rpm",
     64       strlen ("application/x-rpm") + 1,
     65       0
     66     },
     67     {
     68       EXTRACTOR_METATYPE_PACKAGE_NAME,
     69       EXTRACTOR_METAFORMAT_UTF8,
     70       "text/plain",
     71       "libtool",
     72       strlen ("libtool") + 1,
     73       0
     74     },
     75     {
     76       EXTRACTOR_METATYPE_SOFTWARE_VERSION,
     77       EXTRACTOR_METAFORMAT_UTF8,
     78       "text/plain",
     79       "1.5",
     80       strlen ("1.5") + 1,
     81       0
     82     },
     83     {
     84       EXTRACTOR_METATYPE_PACKAGE_VERSION,
     85       EXTRACTOR_METAFORMAT_UTF8,
     86       "text/plain",
     87       "6",
     88       strlen ("6") + 1,
     89       0
     90     },
     91     {
     92       EXTRACTOR_METATYPE_SUMMARY,
     93       EXTRACTOR_METAFORMAT_UTF8,
     94       "text/plain",
     95       SUMMARY,
     96       strlen (SUMMARY) + 1,
     97       0
     98     },
     99     {
    100       EXTRACTOR_METATYPE_DESCRIPTION,
    101       EXTRACTOR_METAFORMAT_UTF8,
    102       "text/plain",
    103       DESCRIPTION,
    104       strlen (DESCRIPTION) + 1,
    105       0
    106     },
    107     {
    108       EXTRACTOR_METATYPE_CREATION_DATE,
    109       EXTRACTOR_METAFORMAT_UTF8,
    110       "text/plain",
    111       "Thu Oct  2 09:44:33 2003",
    112       strlen ("Thu Oct  2 09:44:33 2003") + 1,
    113       0
    114     },
    115     {
    116       EXTRACTOR_METATYPE_BUILDHOST,
    117       EXTRACTOR_METAFORMAT_UTF8,
    118       "text/plain",
    119       "bullwinkle.devel.redhat.com",
    120       strlen ("bullwinkle.devel.redhat.com") + 1,
    121       0
    122     },
    123     {
    124       EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE,
    125       EXTRACTOR_METAFORMAT_UTF8,
    126       "text/plain",
    127       "2623621",
    128       strlen ("2623621") + 1,
    129       0
    130     },
    131     {
    132       EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION,
    133       EXTRACTOR_METAFORMAT_UTF8,
    134       "text/plain",
    135       "Red Hat Linux",
    136       strlen ("Red Hat Linux") + 1,
    137       0
    138     },
    139     {
    140       EXTRACTOR_METATYPE_VENDOR,
    141       EXTRACTOR_METAFORMAT_UTF8,
    142       "text/plain",
    143       "Red Hat, Inc.",
    144       strlen ("Red Hat, Inc.") + 1,
    145       0
    146     },
    147     {
    148       EXTRACTOR_METATYPE_LICENSE,
    149       EXTRACTOR_METAFORMAT_UTF8,
    150       "text/plain",
    151       "GPL",
    152       strlen ("GPL") + 1,
    153       0
    154     },
    155     {
    156       EXTRACTOR_METATYPE_PACKAGE_MAINTAINER,
    157       EXTRACTOR_METAFORMAT_UTF8,
    158       "text/plain",
    159       "Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>",
    160       strlen ("Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>") + 1,
    161       0
    162     },
    163     {
    164       EXTRACTOR_METATYPE_SECTION,
    165       EXTRACTOR_METAFORMAT_UTF8,
    166       "text/plain",
    167       "Development/Tools",
    168       strlen ("Development/Tools") + 1,
    169       0
    170     },
    171     {
    172       EXTRACTOR_METATYPE_URL,
    173       EXTRACTOR_METAFORMAT_UTF8,
    174       "text/plain",
    175       "http://www.gnu.org/software/libtool/",
    176       strlen ("http://www.gnu.org/software/libtool/") + 1,
    177       0
    178     },
    179     {
    180       EXTRACTOR_METATYPE_TARGET_OS,
    181       EXTRACTOR_METAFORMAT_UTF8,
    182       "text/plain",
    183       "linux",
    184       strlen ("linux") + 1,
    185       0
    186     },
    187     {
    188       EXTRACTOR_METATYPE_TARGET_ARCHITECTURE,
    189       EXTRACTOR_METAFORMAT_UTF8,
    190       "text/plain",
    191       "ia64",
    192       strlen ("ia64") + 1,
    193       0
    194     },
    195     {
    196       EXTRACTOR_METATYPE_PACKAGE_PROVIDES,
    197       EXTRACTOR_METAFORMAT_UTF8,
    198       "text/plain",
    199       "libtool",
    200       strlen ("libtool") + 1,
    201       0
    202     },
    203     {
    204       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    205       EXTRACTOR_METAFORMAT_UTF8,
    206       "text/plain",
    207       "/bin/sh",
    208       strlen ("/bin/sh") + 1,
    209       0
    210     },
    211     {
    212       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    213       EXTRACTOR_METAFORMAT_UTF8,
    214       "text/plain",
    215       "/bin/sh",
    216       strlen ("/bin/sh") + 1,
    217       0
    218     },
    219     {
    220       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    221       EXTRACTOR_METAFORMAT_UTF8,
    222       "text/plain",
    223       "/bin/sh",
    224       strlen ("/bin/sh") + 1,
    225       0
    226     },
    227     {
    228       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    229       EXTRACTOR_METAFORMAT_UTF8,
    230       "text/plain",
    231       "/sbin/install-info",
    232       strlen ("/sbin/install-info") + 1,
    233       0
    234     },
    235     {
    236       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    237       EXTRACTOR_METAFORMAT_UTF8,
    238       "text/plain",
    239       "autoconf",
    240       strlen ("autoconf") + 1,
    241       0
    242     },
    243     {
    244       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    245       EXTRACTOR_METAFORMAT_UTF8,
    246       "text/plain",
    247       "automake",
    248       strlen ("automake") + 1,
    249       0
    250     },
    251     {
    252       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    253       EXTRACTOR_METAFORMAT_UTF8,
    254       "text/plain",
    255       "libtool-libs",
    256       strlen ("libtool-libs") + 1,
    257       0
    258     },
    259     {
    260       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    261       EXTRACTOR_METAFORMAT_UTF8,
    262       "text/plain",
    263       "m4",
    264       strlen ("m4") + 1,
    265       0
    266     },
    267     {
    268       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    269       EXTRACTOR_METAFORMAT_UTF8,
    270       "text/plain",
    271       "mktemp",
    272       strlen ("mktemp") + 1,
    273       0
    274     },
    275     {
    276       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    277       EXTRACTOR_METAFORMAT_UTF8,
    278       "text/plain",
    279       "perl",
    280       strlen ("perl") + 1,
    281       0
    282     },
    283     {
    284       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    285       EXTRACTOR_METAFORMAT_UTF8,
    286       "text/plain",
    287       "rpmlib(CompressedFileNames)",
    288       strlen ("rpmlib(CompressedFileNames)") + 1,
    289       0
    290     },
    291     {
    292       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    293       EXTRACTOR_METAFORMAT_UTF8,
    294       "text/plain",
    295       "rpmlib(PayloadFilesHavePrefix)",
    296       strlen ("rpmlib(PayloadFilesHavePrefix)") + 1,
    297       0
    298     },
    299     {
    300       EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
    301       EXTRACTOR_METAFORMAT_UTF8,
    302       "text/plain",
    303       "rpmlib(VersionedDependencies)",
    304       strlen ("rpmlib(VersionedDependencies)") + 1,
    305       0
    306     },
    307     {
    308       EXTRACTOR_METATYPE_TARGET_PLATFORM,
    309       EXTRACTOR_METAFORMAT_UTF8,
    310       "text/plain",
    311       "ia64-redhat-linux-gnu",
    312       strlen ("ia64-redhat-linux-gnu") + 1,
    313       0
    314     },
    315     { 0, 0, NULL, NULL, 0, -1 }
    316   };
    317   struct ProblemSet ps[] = {
    318     { "testdata/rpm_test.rpm",
    319       rpm_test_sol },
    320     { NULL, NULL }
    321   };
    322 
    323   setenv ("TZ", "UTC", 1);
    324   return ET_main ("rpm", ps);
    325 }
    326 
    327 
    328 /* end of test_rpm.c */