Skip to content

Commit 7d1aa83

Browse files
feat(0.1): incorporate PR #44 nondet-generator + fix GoogleTest tag
- Cherry-pick 68cd2eb from fuzzer-option branch (PR #44) - Adds --nondet-generator CLI option (fuzzer/symex) - Fix GoogleTest GIT_TAG to release-1.12.1 for CMake compat - Build OK (50/50), unit tests 7/7 passed - Migration report: docs/migration/0.1-pr44-nondet-generator.md
1 parent 483aabc commit 7d1aa83

3 files changed

Lines changed: 93 additions & 5 deletions

File tree

cmake/CMakeLists.txt.googletest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(googletest-download NONE)
55
include(ExternalProject)
66
ExternalProject_Add(googletest
77
GIT_REPOSITORY https://github.com/google/googletest.git
8-
GIT_TAG master
8+
GIT_TAG release-1.12.1
99
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
1010
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
1111
CONFIGURE_COMMAND ""
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# 0.1 — Incorporar PR #44 (`--nondet-generator`)
2+
3+
**Data:** 17/05/2026
4+
**Status:** ✅ Concluída
5+
6+
## O que foi feito
7+
8+
Cherry-pick do commit `68cd2eb0` da branch `origin/fuzzer-option` (PR #44) para a branch `feat-update`, que já continha as mudanças da PR #46 (`--target-function-name`).
9+
10+
A PR #44 adiciona a opção `--nondet-generator` ao CLI do Map2Check, permitindo selecionar explicitamente o motor de geração de valores não-determinísticos:
11+
- `--nondet-generator symex` → usa apenas KLEE (symbolic execution)
12+
- `--nondet-generator fuzzer` → usa apenas LibFuzzer
13+
- Sem a flag → comportamento padrão: tenta LibFuzzer primeiro, depois KLEE
14+
15+
### Arquivos alterados
16+
- `modules/frontend/map2check.cpp` — 37 inserções, 4 remoções
17+
18+
### Método de integração
19+
```bash
20+
git cherry-pick 68cd2eb0 --no-commit
21+
# Auto-merge sem conflitos com as mudanças da PR #46
22+
```
23+
24+
## Testes executados
25+
26+
### Build
27+
| Teste | Resultado | Observações |
28+
|:------|:---------|:------------|
29+
| `make-release.sh` (50 targets) | ✅ Build OK | Sem erros, 3 warnings esperados (enumeration switch) |
30+
31+
### Testes unitários (7/7)
32+
| Teste | Resultado | Observações |
33+
|:------|:---------|:------------|
34+
| HelloGTest | ✅ Passed | 0.00s |
35+
| AllocationLogTest | ✅ Passed | 0.00s |
36+
| HeapLogTest | ✅ Passed | 0.00s |
37+
| ContainerReallocTest | ✅ Passed | 0.00s |
38+
| BTreeTest | ✅ Passed | 0.16s |
39+
| ContainerBTreeTest | ✅ Passed | 0.15s |
40+
| MemTrackTest | ✅ Passed | 0.00s |
41+
42+
### Testes da funcionalidade PR #44
43+
| Teste | Resultado | Observações |
44+
|:------|:---------|:------------|
45+
| `--nondet-generator symex` (test-0158_1-1.c) | ✅ VERIFICATION SUCCEEDED | Usa apenas KLEE |
46+
| `--nondet-generator fuzzer` (test-0158_1-1.c) | ✅ Timeout (esperado) | Usa apenas LibFuzzer, timeout é comportamento normal |
47+
| `--nondet-generator invalid` | ✅ Erro adequado | Mensagem: "Selected generator don't exist, available: fuzzer symex" |
48+
| Sem flag (comportamento padrão) | ✅ VERIFICATION SUCCEEDED | LibFuzzer → KLEE sequencial, como antes |
49+
50+
## Problemas encontrados
51+
- Nenhum conflito no cherry-pick
52+
- O warning `[-Wswitch]` em `witness.hpp:107` é pré-existente (enumeration `MEMSAFETY` não tratada) — não é causado pelas mudanças da PR #44
53+
54+
## Próximos passos
55+
- **Tarefa 0.2:** Executar suite completa de regressão (9 testes) e registrar baseline definitivo da branch de trabalho (com PRs #44 + #46 integradas)

modules/frontend/map2check.cpp

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ int main(int argc, char **argv) {
297297
("debug", "\tdebug mode")
298298
("input-file", po::value<std::vector<std::string>>(),
299299
"\tspecifies the files")
300+
("nondet-generator", po::value<std::string>(),
301+
R"(specifies the nondet-generator, valid values are fuzzer (libFuzzer),
302+
symex (Klee))")
300303
("smt-solver", po::value<std::string>()->default_value("z3"),
301304
R"(specifies the smt-solver, valid values are stp (STP),
302305
z3 (Z3 is default), btor (Boolector), and yices2 (Yices))")
@@ -410,6 +413,31 @@ z3 (Z3 is default), btor (Boolector), and yices2 (Yices))")
410413
Map2Check::Log::Debug("Current path:");
411414
system("echo $MAP2CHECK_PATH");
412415
}
416+
if (vm.count("nondet-generator")) {
417+
string generatorname = vm["nondet-generator"].as<string>();
418+
std::transform(generatorname.begin(), generatorname.end(),
419+
generatorname.begin(), [](unsigned char c){
420+
return std::tolower(c); });
421+
422+
std::vector<std::string> available_generators = {"fuzzer", "symex"};
423+
424+
if ( !std::count(available_generators.begin(), available_generators.end(), generatorname) ) {
425+
std::cout << "Selected generator don't exist, available: ";
426+
for(auto &s : available_generators) {
427+
std::cout << " " << s << " ";
428+
}
429+
std::cout << desc << "\n";
430+
return ERROR_IN_COMMAND_LINE;
431+
} else {
432+
std::cout << "Adopting " + generatorname + " nondet-generator... \n";
433+
if(generatorname == available_generators[0])
434+
args.generator = Map2Check::NonDetGenerator::LibFuzzer;
435+
if(generatorname == available_generators[1])
436+
args.generator = Map2Check::NonDetGenerator::Klee;
437+
}
438+
} else {
439+
args.generator = Map2Check::NonDetGenerator::None;
440+
}
413441
if (vm.count("input-file")) {
414442
std::string pathfile;
415443
pathfile = accumulate(
@@ -420,10 +448,15 @@ z3 (Z3 is default), btor (Boolector), and yices2 (Yices))")
420448
// std::cout << pathfile << std::endl;
421449
fs::path absolute_path = fs::absolute(pathfile);
422450
args.inputFile = absolute_path.string();
423-
args.generator = Map2Check::NonDetGenerator::LibFuzzer;
424-
map2check_execution(args);
425-
if (!foundViolation) {
426-
args.generator = Map2Check::NonDetGenerator::Klee;
451+
if(args.generator == Map2Check::NonDetGenerator::None) {
452+
args.generator = Map2Check::NonDetGenerator::LibFuzzer;
453+
map2check_execution(args);
454+
if (!foundViolation) {
455+
args.generator = Map2Check::NonDetGenerator::Klee;
456+
map2check_execution(args);
457+
}
458+
}
459+
else {
427460
map2check_execution(args);
428461
}
429462
}

0 commit comments

Comments
 (0)