@@ -362,6 +362,13 @@ cl::opt<unsigned>
362362 " seeding begins, 0 = upload all (default=0)" ),
363363 cl::init(0 ), cl::cat(SeedingCat));
364364
365+ cl::opt<unsigned > UploadPercentage (
366+ " upload-percentage" ,
367+ cl::desc (
368+ " Percentage of seeds stored in executor, that are uploaded every time"
369+ " seeding begins, 0 = disabled (default=100)" ),
370+ cl::init(100 ), cl::cat(SeedingCat));
371+
365372cl::opt<bool > AlwaysOutputSeeds (
366373 " always-output-seeds" , cl::init(true ),
367374 cl::desc(
@@ -1284,10 +1291,6 @@ void Executor::branch(ExecutionState &state,
12841291 for (std::vector<ExecutingSeed>::iterator siit = seeds.begin (),
12851292 siie = seeds.end ();
12861293 siit != siie; ++siit) {
1287- if (siit->maxInstructions &&
1288- siit->maxInstructions < state.steppedInstructions ) {
1289- continue ;
1290- }
12911294 unsigned i;
12921295 for (i = 0 ; i < N; ++i) {
12931296 ref<ConstantExpr> res;
@@ -1446,10 +1449,6 @@ Executor::StatePair Executor::fork(ExecutionState ¤t, ref<Expr> condition,
14461449 for (std::vector<ExecutingSeed>::iterator siit = it->second .begin (),
14471450 siie = it->second .end ();
14481451 siit != siie; ++siit) {
1449- if (siit->maxInstructions &&
1450- siit->maxInstructions < current.steppedInstructions ) {
1451- continue ;
1452- }
14531452 ref<ConstantExpr> result;
14541453 bool success = solver->getValue (current.constraints .cs (),
14551454 siit->assignment .evaluate (condition),
@@ -4601,23 +4600,30 @@ void Executor::getKTestFilesInDir(std::string directoryPath,
46014600
46024601std::vector<ExecutingSeed> Executor::uploadNewSeeds () {
46034602 std::vector<ExecutingSeed> seeds;
4603+ // FIX: experimental option + storedseedslocally behaviour (yes, no, mixed)
4604+ unsigned toUpload = UploadAmount;
4605+ if (UploadPercentage){
4606+ toUpload = (storedSeeds->size () * UploadPercentage) / 100 ;
4607+ if (toUpload == 0 ) toUpload = 1 ;
4608+ }
46044609 if (StoreSeedsLocally) {
4605- while ((!UploadAmount || seeds.size () <= UploadAmount ) &&
4610+ while ((!toUpload || seeds.size () <= toUpload ) &&
46064611 !storedSeeds->empty ()) {
46074612 if (ExploreCompletedSeeds || !storedSeeds->front ().isCompleted ) {
46084613 seeds.push_back (storedSeeds->front ());
46094614 }
46104615 storedSeeds->pop_front ();
46114616 }
4617+ return seeds;
46124618 }
46134619
4614- if (UploadAmount && seeds.size () >= UploadAmount ) {
4620+ if (toUpload && seeds.size () >= toUpload ) {
46154621 return seeds;
46164622 }
46174623
46184624 for (std::vector<std::string>::iterator it = SeedOutFile.begin (),
46194625 ie = SeedOutFile.end ();
4620- it != ie && (!UploadAmount || seeds.size () <= UploadAmount ); ++it) {
4626+ it != ie && (!toUpload || seeds.size () <= toUpload ); ++it) {
46214627 ExecutingSeed out (it->substr (0 , it->size () - 5 ));
46224628 if (!out.input ) {
46234629 klee_error (" unable to open: %s\n " , (*it).c_str ());
@@ -4633,7 +4639,7 @@ std::vector<ExecutingSeed> Executor::uploadNewSeeds() {
46334639 getKTestFilesInDir (*it, kTestFiles );
46344640 for (std::vector<std::string>::iterator it2 = kTestFiles .begin (),
46354641 ie = kTestFiles .end ();
4636- it2 != ie && (!UploadAmount || seeds.size () <= UploadAmount ); ++it2) {
4642+ it2 != ie && (!toUpload || seeds.size () <= toUpload ); ++it2) {
46374643 ExecutingSeed out (it2->substr (0 , it2->size () - 5 ));
46384644 if (!out.input ) {
46394645 klee_error (" unable to open: %s\n " , (*it2).c_str ());
0 commit comments