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

grass-addons: initial integration #12889

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions projects/grass-addons/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
RUN git clone --depth 1 https://github.com/OSGeo/grass-addons.git /src/grass-addons
WORKDIR /src/grass-addons
COPY build.sh $SRC/
24 changes: 24 additions & 0 deletions projects/grass-addons/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -eu
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

mkdir build
cd build
cmake ..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work, there is no CMakeLists.txt in the project 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @tyler92 i had updated build.sh script but still build check is failing Could you please help in this to create build.sh script so it will pass testcases
Thanks

make -j$(nproc)

$CXX $CXXFLAGS -I /src/grass-addons/include /src/grass-addons/fuzz_target.c -o $OUT/fuzz_target \
$LIB_FUZZING_ENGINE /src/grass-addons/src/*.o
53 changes: 53 additions & 0 deletions projects/grass-addons/fuzz_target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2024 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is already merged in the project-under-test (which is also the way OSS-Fuzz prefers), shall we remove it here and update the build script?

Copy link
Contributor Author

@Shivam7-1 Shivam7-1 Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @DonggeLiu
Thanks i think it not required now it can be mergable directly here also

If removing is better you can do it Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @DonggeLiu Any merging Update on this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the fuzz target file?
Also, could you please address the CI failure, as @tyler92 kindly pointed out?
Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @DonggeLiu I had Updated Code accordingly and remove fuzz file from is it looks good now
Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes as i check is the only reason with header change to 2024 to 2025?
Or any update required on build.sh file
Could you help review build.sh file if possible because i am integarting project first time
Thanms

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see this in https://github.com/google/oss-fuzz/actions/runs/12921531205/job/36035725551?pr=12889?

clang++: error: no such file or directory: 'https://github.com/OSGeo/grass-addons/blob/grass8/Fuzz/fuzz_target.c'

ALL CI checks should pass before we can merge, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @DonggeLiu Here i am geeting this error and i wont be able to the find the problem behind this Could you help in this
image
Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hii @DonggeLiu still geeting error
image
Can you help in this PR
Is i am missing something here
Thanks

//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <stdint.h>
#include <stddef.h>
#include "pavl.h"
#include "sort.h"
#include "local_proto.h"
#include "test_simulation.cpp"
#include "test_treatments.cpp"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
if (size < sizeof(int))
return 0;

int input = *(int *)data;

// fuzz test for pavl_create function from pavl.h
struct pavl_table *table = pavl_create(NULL, NULL, NULL);
if (table) {
pavl_destroy(table, NULL);
}

// fuzz test for Mergesort_increasing_smallest_azimuth function from sort.h
struct node head;
struct node tail;
Mergesort_increasing_smallest_azimuth(&head, &tail);

// Fuzz test for functions from local_proto.h
float result = f_and(input, input, E);
result += f_or(input, input, E);
result += f_not(input, E);

// Fuzz test for test_simulation.cpp
ret += test_calling_all_functions();

// Fuzz test for test_treatments.cpp
ret += test_steering();

return 0;
}
11 changes: 11 additions & 0 deletions projects/grass-addons/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: grass-addons
path: OSGeo/grass-addons
homepage: "https://grass.osgeo.org/grass-stable/manuals/addons/"
language: c++
primary_contact: "[email protected]"
fuzzing_engines:
- libfuzzer
sanitizers:
- address
- undefined
main_repo: 'https://github.com/OSGeo/grass-addons'
Loading