@@ -362,6 +362,13 @@ cl::opt<unsigned>
362
362
" seeding begins, 0 = upload all (default=0)" ),
363
363
cl::init(0 ), cl::cat(SeedingCat));
364
364
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
+
365
372
cl::opt<bool > AlwaysOutputSeeds (
366
373
" always-output-seeds" , cl::init(true ),
367
374
cl::desc(
@@ -1284,10 +1291,6 @@ void Executor::branch(ExecutionState &state,
1284
1291
for (std::vector<ExecutingSeed>::iterator siit = seeds.begin (),
1285
1292
siie = seeds.end ();
1286
1293
siit != siie; ++siit) {
1287
- if (siit->maxInstructions &&
1288
- siit->maxInstructions < state.steppedInstructions ) {
1289
- continue ;
1290
- }
1291
1294
unsigned i;
1292
1295
for (i = 0 ; i < N; ++i) {
1293
1296
ref<ConstantExpr> res;
@@ -1446,10 +1449,6 @@ Executor::StatePair Executor::fork(ExecutionState ¤t, ref<Expr> condition,
1446
1449
for (std::vector<ExecutingSeed>::iterator siit = it->second .begin (),
1447
1450
siie = it->second .end ();
1448
1451
siit != siie; ++siit) {
1449
- if (siit->maxInstructions &&
1450
- siit->maxInstructions < current.steppedInstructions ) {
1451
- continue ;
1452
- }
1453
1452
ref<ConstantExpr> result;
1454
1453
bool success = solver->getValue (current.constraints .cs (),
1455
1454
siit->assignment .evaluate (condition),
@@ -4601,23 +4600,30 @@ void Executor::getKTestFilesInDir(std::string directoryPath,
4601
4600
4602
4601
std::vector<ExecutingSeed> Executor::uploadNewSeeds () {
4603
4602
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
+ }
4604
4609
if (StoreSeedsLocally) {
4605
- while ((!UploadAmount || seeds.size () <= UploadAmount ) &&
4610
+ while ((!toUpload || seeds.size () <= toUpload ) &&
4606
4611
!storedSeeds->empty ()) {
4607
4612
if (ExploreCompletedSeeds || !storedSeeds->front ().isCompleted ) {
4608
4613
seeds.push_back (storedSeeds->front ());
4609
4614
}
4610
4615
storedSeeds->pop_front ();
4611
4616
}
4617
+ return seeds;
4612
4618
}
4613
4619
4614
- if (UploadAmount && seeds.size () >= UploadAmount ) {
4620
+ if (toUpload && seeds.size () >= toUpload ) {
4615
4621
return seeds;
4616
4622
}
4617
4623
4618
4624
for (std::vector<std::string>::iterator it = SeedOutFile.begin (),
4619
4625
ie = SeedOutFile.end ();
4620
- it != ie && (!UploadAmount || seeds.size () <= UploadAmount ); ++it) {
4626
+ it != ie && (!toUpload || seeds.size () <= toUpload ); ++it) {
4621
4627
ExecutingSeed out (it->substr (0 , it->size () - 5 ));
4622
4628
if (!out.input ) {
4623
4629
klee_error (" unable to open: %s\n " , (*it).c_str ());
@@ -4633,7 +4639,7 @@ std::vector<ExecutingSeed> Executor::uploadNewSeeds() {
4633
4639
getKTestFilesInDir (*it, kTestFiles );
4634
4640
for (std::vector<std::string>::iterator it2 = kTestFiles .begin (),
4635
4641
ie = kTestFiles .end ();
4636
- it2 != ie && (!UploadAmount || seeds.size () <= UploadAmount ); ++it2) {
4642
+ it2 != ie && (!toUpload || seeds.size () <= toUpload ); ++it2) {
4637
4643
ExecutingSeed out (it2->substr (0 , it2->size () - 5 ));
4638
4644
if (!out.input ) {
4639
4645
klee_error (" unable to open: %s\n " , (*it2).c_str ());
0 commit comments