test_iso9660.c (4051B)
1 /* 2 This file is part of libextractor. 3 Copyright (C) 2026 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_iso9660.c 22 * @brief testcase for the iso9660 plugin 23 * @author Christian Grothoff 24 */ 25 #include "platform.h" 26 #include "test_lib.h" 27 28 29 /** 30 * Shorthand for a plain UTF-8 text solution. 31 */ 32 #define TEXT_SOLUTION(type, value) \ 33 { (type), EXTRACTOR_METAFORMAT_UTF8, "text/plain", \ 34 (value), strlen (value) + 1, 0, 0, NULL } 35 36 37 /** 38 * Main function for the iso9660 testcase. 39 * 40 * @param argc number of arguments (ignored) 41 * @param argv arguments (ignored) 42 * @return 0 on success 43 */ 44 int 45 main (int argc, char *argv[]) 46 { 47 struct SolutionData iso_test_sol[] = { 48 TEXT_SOLUTION (EXTRACTOR_METATYPE_MIMETYPE, 49 "application/x-iso9660-image"), 50 TEXT_SOLUTION (EXTRACTOR_METATYPE_FILESYSTEM_TYPE, 51 "ISO 9660"), 52 /* supplementary volume descriptor with the "%/E" escape */ 53 TEXT_SOLUTION (EXTRACTOR_METATYPE_FILESYSTEM_TYPE, 54 "Joliet"), 55 /* SUSP `SP' and `RR' entries in the root directory's "." record */ 56 TEXT_SOLUTION (EXTRACTOR_METATYPE_FILESYSTEM_TYPE, 57 "Rock Ridge"), 58 /* boot record naming the El Torito specification */ 59 TEXT_SOLUTION (EXTRACTOR_METATYPE_COMMENT, 60 "bootable (El Torito)"), 61 /* -- the identifier fields of the primary volume descriptor -- */ 62 TEXT_SOLUTION (EXTRACTOR_METATYPE_SYSTEM_IDENTIFIER, 63 "LINUX"), 64 TEXT_SOLUTION (EXTRACTOR_METATYPE_VOLUME_NAME, 65 "FORENSIC_TEST_VOL"), 66 TEXT_SOLUTION (EXTRACTOR_METATYPE_PUBLISHER, 67 "GNU LIBEXTRACTOR PROJECT"), 68 TEXT_SOLUTION (EXTRACTOR_METATYPE_DATA_PREPARER, 69 "LIBEXTRACTOR TEST SUITE"), 70 /* the application identifier: the mastering software */ 71 TEXT_SOLUTION (EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE, 72 "MKISOFS 2.01 (LIBEXTRACTOR TEST IMAGE)"), 73 TEXT_SOLUTION (EXTRACTOR_METATYPE_COPYRIGHT, 74 "COPYING.TXT"), 75 TEXT_SOLUTION (EXTRACTOR_METATYPE_ABSTRACT, 76 "ABSTRACT.TXT"), 77 TEXT_SOLUTION (EXTRACTOR_METATYPE_COMMENT, 78 "bibliographic file: BIBLIO.TXT"), 79 /* -- geometry: 21 sectors of 2048 bytes -- */ 80 TEXT_SOLUTION (EXTRACTOR_METATYPE_BLOCK_SIZE, 81 "2048"), 82 TEXT_SOLUTION (EXTRACTOR_METATYPE_VOLUME_SIZE, 83 "43008"), 84 /* volume set size is 2 */ 85 TEXT_SOLUTION (EXTRACTOR_METATYPE_ENTRY_COUNT, 86 "2"), 87 /* -- the four dec-datetime fields, each with a GMT offset of 0 -- */ 88 TEXT_SOLUTION (EXTRACTOR_METATYPE_CREATION_DATE, 89 "2024-03-15T12:34:56Z"), 90 TEXT_SOLUTION (EXTRACTOR_METATYPE_MODIFICATION_DATE, 91 "2025-01-02T03:04:05Z"), 92 TEXT_SOLUTION (EXTRACTOR_METATYPE_EXPIRATION_DATE, 93 "2030-06-01T00:00:00Z"), 94 TEXT_SOLUTION (EXTRACTOR_METATYPE_COMMENT, 95 "volume effective from 2024-03-16T00:00:00Z"), 96 { 0, 0, NULL, NULL, 0, -1, 0, NULL } 97 }; 98 struct ProblemSet ps[] = { 99 { "testdata/iso9660_test.iso", 100 iso_test_sol }, 101 { NULL, NULL } 102 }; 103 104 (void) argc; 105 (void) argv; 106 return ET_main ("iso9660", ps); 107 } 108 109 110 /* end of test_iso9660.c */