Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations #109

Merged
merged 3 commits into from
Feb 22, 2024
Merged

Annotations #109

merged 3 commits into from
Feb 22, 2024

Conversation

ladisgin
Copy link
Member

@ladisgin ladisgin commented Aug 7, 2023

Summary:

Checklist:

  • The PR addresses a single issue. If it can be divided into multiple independent PRs, please do so.
  • The PR is divided into a logical sequence of commits OR a single commit is sufficient.
  • There are no unnecessary commits (e.g. commits fixing issues in a previous commit in the same PR).
  • Each commit has a meaningful message documenting what it does.
  • All messages added to the codebase, all comments, as well as commit messages are spellchecked.
  • The code is commented OR not applicable/necessary.
  • The patch is formatted via clang-format OR not applicable (if explicitly overridden leave unchecked and explain).
  • There are test cases for the code you added or modified OR no such test cases are required.

@ladisgin ladisgin force-pushed the ladisgin/annotations branch 4 times, most recently from ee43db0 to ba0a8c1 Compare August 8, 2023 14:23
@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2023

Codecov Report

Merging #109 (1dabff0) into main (7f6fd2d) will increase coverage by 0.05%.
The diff coverage is 70.17%.

❗ Current head 1dabff0 differs from pull request most recent head e749e81. Consider uploading reports for the commit e749e81 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   69.42%   69.47%   +0.05%     
==========================================
  Files         210      213       +3     
  Lines       30083    30860     +777     
  Branches     6668     6827     +159     
==========================================
+ Hits        20884    21439     +555     
- Misses       6693     6852     +159     
- Partials     2506     2569      +63     
Files Coverage Δ
include/klee/Core/Interpreter.h 100.00% <100.00%> (ø)
include/klee/Expr/AlphaBuilder.h 100.00% <ø> (ø)
include/klee/Expr/IndependentSet.h 69.76% <ø> (ø)
include/klee/Module/SarifReport.h 88.23% <ø> (ø)
lib/Core/ExecutionState.cpp 71.63% <ø> (ø)
lib/Core/Executor.h 74.07% <ø> (ø)
lib/Core/SpecialFunctionHandler.h 0.00% <ø> (ø)
lib/Expr/AlphaBuilder.cpp 95.08% <100.00%> (+0.85%) ⬆️
lib/Expr/ExprUtil.cpp 91.83% <100.00%> (+0.43%) ⬆️
lib/Expr/SourceBuilder.cpp 76.19% <100.00%> (+3.46%) ⬆️
... and 14 more

... and 2 files with indirect coverage changes

@ladisgin ladisgin force-pushed the ladisgin/annotations branch 3 times, most recently from 3a97454 to 2541973 Compare August 14, 2023 09:47
@ladisgin
Copy link
Member Author

ladisgin commented Aug 22, 2023

https://github.com/program-analysis-team/cooddy/blob/master/config/.annotations.json

#!/bin/python3

import sys
import json

def getNames(name: str) :
    name = name.replace(" ", "")
    openBracketIndex = name.find("(")
    closeBracketIndex = name.find(")")
    if openBracketIndex == -1 or openBracketIndex + 1 == closeBracketIndex :
        return name, name
    else:
        funcName = name[:openBracketIndex]
        mangledName = name[openBracketIndex + 1:closeBracketIndex]
        return funcName, mangledName


def transform(coody_json):
    utbot_json = {}
    for coody_name, annotation in coody_json.items():
        funcName, mangledName = getNames(coody_name)
        utbot_json[mangledName] = {"name": funcName, "annotation": annotation, "properties": []}
    return utbot_json


fi = open(sys.argv[1], "r")
j = json.load(fi)
res = transform(j)
# print(res)

fo = open("klee_annotation.json", "w")
json.dump(res, fo, indent=True)

@ladisgin
Copy link
Member Author

TODO Add implementation for AllocSource

@ladisgin ladisgin force-pushed the ladisgin/annotations branch 6 times, most recently from 3c1ed04 to e2ef6df Compare September 4, 2023 09:42
@Columpio
Copy link
Collaborator

Columpio commented Sep 12, 2023

In my opinion, the following steps should be made before merging it to main:

  • Remove Add mocks #80 as this PR incorporates its features but also advances further
  • (Obviously) rebase on main
  • Remove duplicated mocking functionality, i.e., unify functionality given by flags MockExternalCalls, MockAllExternals, MockLinkedExternals, MockUnlinkedStrategy
  • Add our own annotations file (probably, based on Cooddy one) and enable it by default
  • Remove flags absorbed by annotations, like NullOnZeroMalloc

@ladisgin ladisgin force-pushed the ladisgin/annotations branch from e2ef6df to 92c1d97 Compare September 12, 2023 10:19
@ladisgin ladisgin changed the title Ladisgin/annotations Annotations Sep 12, 2023
@ladisgin ladisgin force-pushed the ladisgin/annotations branch from 92c1d97 to 5736c61 Compare October 6, 2023 15:12
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 2 times, most recently from 38e4b05 to 314646f Compare October 27, 2023 15:11
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 4 times, most recently from e8be3d8 to 2860ecc Compare November 7, 2023 11:48
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 3 times, most recently from e0ce902 to a80571e Compare November 13, 2023 07:20
@ladisgin ladisgin force-pushed the ladisgin/annotations branch from a80571e to 9c0048e Compare November 13, 2023 08:09
@ladisgin
Copy link
Member Author

ladisgin commented Nov 13, 2023

  • mock-linked-externals renamed to mock-modeled-functions
  • mock-all-externals ~= mock-policy=all
  • mock-external-calls move to mock-policy=failed
  • mock-strategy now have two value naive and deterministic used only with mock-policy=all
  • mock-mutable-globals move to Mock category

NullOnZeroMalloc argument from original KLEE it'll be better save compatibility
Add configs/annotations.json, but don't add it by default, because this test has a complex replay that only works with llvm.

@ladisgin ladisgin marked this pull request as ready for review November 13, 2023 15:57
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 2 times, most recently from 3e1710b to c2a5ab8 Compare November 20, 2023 12:27
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 2 times, most recently from f148c5b to d898c1a Compare November 28, 2023 17:51
@ladisgin ladisgin force-pushed the ladisgin/annotations branch from d898c1a to 97cb313 Compare January 15, 2024 15:52
@ladisgin ladisgin force-pushed the ladisgin/annotations branch from 80cc67b to 364d6da Compare February 13, 2024 12:45
@ladisgin ladisgin force-pushed the ladisgin/annotations branch 2 times, most recently from d15dc1f to 6d162a0 Compare February 21, 2024 15:48
Lana243 and others added 3 commits February 22, 2024 16:09
- Generation in two modes: naive and determinitic
- Mocks are reproducible
- Special mocks for allocators: malloc, calloc, realloc
 - Merge args for external calls
 - Add config example in config/annotations.json
@ladisgin ladisgin force-pushed the ladisgin/annotations branch from 7602f6a to e749e81 Compare February 22, 2024 13:17
@misonijnik misonijnik merged commit b399e64 into main Feb 22, 2024
26 checks passed
@misonijnik misonijnik mentioned this pull request Feb 22, 2024
8 tasks
@ladisgin ladisgin deleted the ladisgin/annotations branch March 7, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants