58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
/*
|
|
* Unit test iso reading functions
|
|
*/
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
#include "test.h"
|
|
#include "ecma119_read_rr.h"
|
|
#include "util.h"
|
|
|
|
static void
|
|
test_read_rr_PX()
|
|
{
|
|
struct iso_read_info info;
|
|
struct susp_sys_user_entry px;
|
|
struct stat atts;
|
|
int res;
|
|
|
|
info.src = NULL; /* data source is not needed */
|
|
info.error = 0;
|
|
info.ino = 0;
|
|
|
|
memset(&atts, 0, sizeof(atts));
|
|
|
|
/* fill px struct */
|
|
px.sig[0] = 'P';
|
|
px.sig[1] = 'X';
|
|
px.version[0] = 1;
|
|
iso_bb(px.data.PX.uid, 33, 4);
|
|
iso_bb(px.data.PX.gid, 22, 4);
|
|
iso_bb(px.data.PX.links, 7, 4);
|
|
iso_bb(px.data.PX.mode, S_IFREG | 0555, 4);
|
|
|
|
/* a) test with RRIP 1.12 */
|
|
info.rr = RR_EXT_112;
|
|
px.len_sue[0] = 44;
|
|
iso_bb(px.data.PX.serial, 678, 4);
|
|
|
|
res = read_rr_PX(&info, &px, &atts);
|
|
CU_ASSERT_EQUAL(res, 0);
|
|
CU_ASSERT_EQUAL(atts.st_uid, 33);
|
|
CU_ASSERT_EQUAL(atts.st_gid, 22);
|
|
CU_ASSERT_EQUAL(atts.st_mode, (mode_t) S_IFREG | 0555);
|
|
CU_ASSERT_EQUAL(atts.st_nlink, 7);
|
|
CU_ASSERT_EQUAL(atts.st_ino, 678);
|
|
//TODO
|
|
|
|
}
|
|
|
|
void add_isoread_suite()
|
|
{
|
|
CU_pSuite pSuite = CU_add_suite("IsoReadSuite", NULL, NULL);
|
|
|
|
CU_add_test(pSuite, "test of read_rr_PX()", test_read_rr_PX);
|
|
}
|