multithreading - MbUnit Icarus self-destructs on this test -


i'm trying test multi-threaded io class using mbunit. goal have test fixture constructor execute 3 times, once each row on class. then, each instance, execute tests multiple times on parallell threads.

however, icarus blows 'index out of range' on taskrunner. can't full stack, spawns message boxes fast.

what doing wrong, or bug in mbunit/gallio?

using system; using system.collections.generic; using system.text; using gallio.framework; using mbunit.framework; using mbunit.framework.contractverifiers; using system.io;  namespace imageresizer.plugins.diskcache.tests {     [testfixture]     [row(0,50,false)]     [row(0,50,true)]     [row(8000,100,true)]     public class customdiskcachetest {          public customdiskcachetest(int subfolders, int totalfiles, bool hashmodifieddate) {             char c = system.io.path.directoryseparatorchar;             string folder = system.io.path.gettemppath().trimend(c) + c + system.io.path.getrandomfilename();             cache = new customdiskcache(folder,subfolders,hashmodifieddate);             this.quantity = totalfiles;              (int = 0; < quantity;i++){                 cache.getcachedfile(i.tostring(),"test",delegate(stream s){                     s.writebyte(32); //just 1 space                 },defaultdate, 10);             }         }         int quantity;         customdiskcache cache = null;         datetime defaultdate = new datetime(2011, 1, 1);          [threadedrepeat(150)]         [test(order=1)]         public void testaccess() {             cacheresult r =                  cache.getcachedfile(new random().next(0, quantity).tostring(), "test",                  delegate(stream s) { assert.fail("no files have been modified, should not execute"); }, defaultdate, 100);              assert.istrue(system.io.file.exists(r.physicalpath));             assert.istrue(r.result == cachequeryresult.hit);         }          volatile int seed = 0;         [test (order=2)]         [threadedrepeat(20)]         public void testupdate() {             //try unique date time value             datetime newtime = datetime.utcnow.adddays(seed++);             cacheresult r =                 cache.getcachedfile(new random().next(0, quantity).tostring(), "test",                 delegate(stream s) {                     s.writebyte(32); //just 1 space                 }, newtime, 100);              assert.areequal<datetime>(newtime, system.io.file.getlastwritetimeutc(r.physicalpath));             assert.istrue(r.result == cachequeryresult.miss);         }           [test(order=3)]         public void testclear() {             system.io.directory.delete(cache.physicalcachepath, true);         }     } } 

i wont answer direct question bug think following steps find error , not lost in popping message boxes

  • decrease numbers of totalfiles , subfolders lower values see if error persists in 2 or 1 file counts

    • your tests code isn't super easy, should be, write tests tests know running correct, maybe random nexts problem, maybe else, tests should easy.

    • figure out test breaks system, code contains 3 tests, , constructor, comment 2 other tests , see 1 produces error

    • your threaded repeat 150 looks pretty sick, maybe try smaller number 2 or 3 if error basic 2 threads might break, if run 150 threads can understand trouble message boxes

    • add logging , try catch - catch index exception , log class state carefully, after inspecting think youll see problem more clearly.

right cant figure out problem think, got many variables , not mention didnt provide code cache class might contain simple error causing it, before mbunit features begin show up.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -