-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SQUASH] Add Required
v1
API Features With Tests & CI (#2)
* marking v1 * Debug Mode * Remove Local Database Feature Local database management turned out to not be such a good idea. Why? because now users can apply existing analysis in rizin and cutter plugins and hence no need to track binary id or analysis id or hashes of uploaded files. If this new feature were not to be added, then local db management is a very helpful feature to have IMO * Log Now Available Globally - Auth Check endpoint works - Log object management removed, Log now available globally. Logging will be initialized as soon as the library is loaded and all logs will be stored in tmpdir. * Auth Check Takes Host Param As Well API key works correctly only with it's corresponding host. Auth check now sets the host as well. * Get AI Models Add new endpoint to get available AI models * Remove Redundant Model Arguments Plugins now don't use a static modelname-version syntax to specify versions. All AI model information is passed into the struct of arguments of API that requires it. * Mock API * [BUG] Add Tests There are some bugs found during execution of these tests Strange, I never thought they'd exist like this. While writing the tests I thought they'd be useless. * Fix Some Memory Leaks The bug still remains unfixed. * [BUGFIX] Remove Free On Json String The json string getter method does not duplicate the string and hence ownership still remained with cJSON object. One of the Json getter method destroyed the returned string and hence it was a double-free bug, because in the end the cJSON object tried to destroy it was well. Phew! * Update README For cJSON Dependency Recently faced a RPATH issue when building and installing cJSON from source on Mac OS. The updated README provides hints on how that can be fixed. * [HACK] Add CI Tests & Make Up For Poor Documentation Documentation for `/v1/ann/symbol/batch` seems to be incorrect. Can't wait for getting a response and then making decision based on that, so for now moving ahead with a hack to optionally check for `function_matches` field the second time. I'm referring to the JSON response parsing code in Response.c * Update ci.yaml To Run On Any Commit/Push * CI Error Fix * Update CI To Create TMP Directory & Display Logs * To Review & Merge Some small non-necessary fixes to follow a proper coding style throughout. * Use `memmove` in vec_remove * `FREE` Automatically Sets To `NULL` No need to explicitly sets variables to `NULL` after using `FREE` on them, this is automatically done in `FREE` macro
- Loading branch information
1 parent
c47ee65
commit 3412096
Showing
28 changed files
with
1,735 additions
and
275,650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CMake Build and Test | ||
|
||
on: | ||
push: # Trigger on any push to any branch | ||
pull_request: # Trigger on any PR | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Set up dependencies | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y cmake gcc g++ ninja-build libcurl4-openssl-dev pkg-config | ||
# Configure the build | ||
- name: Configure with CMake | ||
run: | | ||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | ||
# Build the project | ||
- name: Build the project | ||
run: | | ||
ninja -C build | ||
# Create temporary directory for logs | ||
- name: Create temporary directory | ||
run: | | ||
export TMP=$(mktemp -d) | ||
echo "Temporary directory created at $TMP" | ||
echo "TMP=$TMP" >> $GITHUB_ENV | ||
# Run tests | ||
- name: Run tests | ||
run: | | ||
./build/bin/reai_test | ||
# Output logs from the temporary directory | ||
- name: Display logs | ||
run: | | ||
echo "Logs from $TMP:" | ||
ls "$TMP" | ||
cat "$TMP"/* || echo "No log files found" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Build/ | ||
Build*/ | ||
build*/ | ||
.cache/ | ||
compile_commands.json | ||
*.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @file ApiError.h | ||
* @date 5th Dec 2024 | ||
* @author Siddharth Mishra ([email protected]) | ||
* @copyright Copyright (c) RevEngAI. All Rights Reserved. | ||
* */ | ||
|
||
#ifndef REAI_API_ERROR_H | ||
#define REAI_API_ERROR_H | ||
|
||
#include <Reai/Types.h> | ||
#include <Reai/Util/Vec.h> | ||
|
||
typedef struct { | ||
CString code; | ||
CString message; | ||
} ReaiApiError; | ||
|
||
ReaiApiError* reai_api_error_clone_init (ReaiApiError* dst, ReaiApiError* src); | ||
ReaiApiError* reai_api_error_clone_deinit (ReaiApiError* clone); | ||
|
||
REAI_MAKE_VEC ( | ||
ReaiApiErrors, | ||
api_error, | ||
ReaiApiError, | ||
reai_api_error_clone_init, | ||
reai_api_error_vec_init | ||
); | ||
|
||
#endif // REAI_API_ERROR_H |
Oops, something went wrong.