Ticket #1592: r45961.diff

File r45961.diff, 3.3 KB (added by jkeenan, 4 years ago)

revision in which failure in t/op/io.t (non-optimized) build first occurred

  • src/io/api.c

     
    122122    ASSERT_ARGS(Parrot_io_open) 
    123123    PMC *new_filehandle, *filehandle; 
    124124    INTVAL flags; 
     125    const INTVAL typenum = Parrot_get_ctx_HLL_type(interp, Parrot_PMC_typenum(interp, "FileHandle")); 
    125126    if (PMC_IS_NULL(pmc)) { 
    126         /* TODO: We should look up the HLL mapped type, instead of always 
    127            using FileHandle here */ 
    128         new_filehandle = Parrot_pmc_new(interp, enum_class_FileHandle); 
    129         PARROT_ASSERT(new_filehandle->vtable->base_type == enum_class_FileHandle); 
     127        new_filehandle = Parrot_pmc_new(interp, typenum); 
     128        PARROT_ASSERT(new_filehandle->vtable->base_type == typenum); 
    130129    } 
    131130    else 
    132131        new_filehandle = pmc; 
    133132 
    134133    flags = Parrot_io_parse_open_flags(interp, mode); 
    135     if (new_filehandle->vtable->base_type == enum_class_FileHandle) { 
     134    if (new_filehandle->vtable->base_type == typenum) { 
    136135        /* TODO: StringHandle may have a null path, but a filehandle really 
    137136           shouldn't allow that. */ 
    138         PARROT_ASSERT(new_filehandle->vtable->base_type == enum_class_FileHandle); 
     137        PARROT_ASSERT(new_filehandle->vtable->base_type == typenum); 
    139138        filehandle = PIO_OPEN(interp, new_filehandle, path, flags); 
    140139        if (PMC_IS_NULL(filehandle)) 
    141140            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR, 
    142141                "Unable to open filehandle from path '%S'", path); 
    143         PARROT_ASSERT(filehandle->vtable->base_type == enum_class_FileHandle); 
     142        PARROT_ASSERT(filehandle->vtable->base_type == typenum); 
    144143        SETATTR_FileHandle_flags(interp, new_filehandle, flags); 
    145144        SETATTR_FileHandle_filename(interp, new_filehandle, path); 
    146145        SETATTR_FileHandle_mode(interp, new_filehandle, mode); 
  • t/op/io.t

     
    1616 
    1717=cut 
    1818 
    19 .const int TESTS = 4 
     19.const int TESTS = 5 
    2020 
    2121.sub 'main' :main 
    2222    .include 'test_more.pir' 
    2323 
    2424    plan(TESTS) 
    2525 
     26    open_delegates_to_filehandle_pmc() 
    2627    open_null_filename() 
    2728    open_null_mode() 
    2829    open_pipe_for_reading() 
    2930    open_pipe_for_writing() 
    3031.end 
    3132 
     33.sub open_delegates_to_filehandle_pmc 
     34    load_bytecode 'P6object.pbc' 
     35 
     36    .local pmc p6meta, interp, classes, classid 
     37    p6meta = get_root_global ["parrot"], "P6metaclass" 
     38    p6meta.'new_class'('Testing') 
     39 
     40    interp = getinterp 
     41    classes = interp[0] 
     42    classid = classes['Testing'] 
     43    $I0 = classes['FileHandle'] 
     44    set classes['FileHandle'], classid 
     45 
     46    $P1 = open '/foo' 
     47 
     48    # replace the original, so we don't break other tests 
     49    set classes['FileHandle'], $I0 
     50 
     51.end 
     52 
    3253.sub 'open_null_filename' 
    3354    push_eh open_null_filename_failed 
    3455    null $S0 
     
    127148    .local pmc pipe 
    128149    pipe = open command, 'wp' 
    129150    unless pipe goto open_pipe_for_writing_failed 
    130     pipe.'puts'("ok - open pipe for writing\n") 
     151 
     152    pipe.'puts'("ok 5 - open pipe for writing\n") 
    131153    close pipe 
    132154    .return () 
    133155 
     
    140162 
    141163.end 
    142164 
     165.namespace ["Testing"] 
     166 
     167.sub open :method 
     168    .param pmc args :slurpy 
     169    ok(1,'open opcode delegates to the FileHandle PMC') 
     170.end 
     171 
     172 
    143173# Local Variables: 
    144174#   mode: pir 
    145175#   fill-column: 100