From 31a78aff220bb3edc47690631c68646457bd7b0d Mon Sep 17 00:00:00 2001 From: RainbowseaExplore Date: Thu, 3 Jul 2025 16:23:31 +0800 Subject: [PATCH] containers fuzz update Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICGV2Z?from=project-issue Signed-off-by: RainbowseaExplore --- test/fuzztest/BUILD.gn | 31 ++ .../containersdequecommon_fuzzer.h | 44 -- .../containersdequeforeach_fuzzer/BUILD.gn | 43 -- .../BUILD.gn | 9 +- .../containersplainarrayaddhas_fuzzer.cpp} | 52 +-- .../containersplainarrayaddhas_fuzzer.h} | 40 +- .../corpus/init | 0 .../project.xml | 0 .../containersplainarraycommon_fuzzer.h} | 397 +----------------- .../BUILD.gn | 8 +- .../containersplainarrayget_fuzzer.cpp} | 52 +-- .../containersplainarrayget_fuzzer.h} | 6 +- .../corpus/init | 26 +- .../project.xml | 50 +-- .../BUILD.gn | 46 ++ ...ntainersplainarraygetindexofkey_fuzzer.cpp | 27 ++ ...containersplainarraygetindexofkey_fuzzer.h | 21 + .../corpus/init | 26 +- .../project.xml | 50 +-- .../BUILD.gn | 46 ++ ...ainersplainarraygetindexofvalue_fuzzer.cpp | 27 ++ ...tainersplainarraygetindexofvalue_fuzzer.h} | 40 +- .../corpus/init | 26 +- .../project.xml | 50 +-- .../BUILD.gn | 9 +- .../containersplainarraygetkeyat_fuzzer.cpp} | 52 +-- .../containersplainarraygetkeyat_fuzzer.h} | 40 +- .../corpus/init | 26 +- .../project.xml | 50 +-- .../BUILD.gn | 11 +- ...containersplainarraygetvalueat_fuzzer.cpp} | 52 +-- .../containersplainarraygetvalueat_fuzzer.h} | 40 +- .../corpus/init | 14 + .../project.xml | 25 ++ .../BUILD.gn | 11 +- .../containersplainarrayremove_fuzzer.cpp} | 52 +-- .../containersplainarrayremove_fuzzer.h} | 40 +- .../corpus/init | 14 + .../project.xml | 25 ++ .../BUILD.gn | 46 ++ .../containersplainarrayremoveat_fuzzer.cpp} | 52 +-- .../containersplainarrayremoveat_fuzzer.h | 21 + .../corpus/init | 14 + .../project.xml | 25 ++ .../BUILD.gn | 46 ++ ...ainersplainarrayremoverangefrom_fuzzer.cpp | 27 ++ ...ntainersplainarrayremoverangefrom_fuzzer.h | 21 + .../corpus/init | 14 + .../project.xml | 25 ++ .../BUILD.gn | 46 ++ ...containersplainarraysetvalueat_fuzzer.cpp} | 52 +-- .../containersplainarraysetvalueat_fuzzer.h} | 40 +- .../corpus/init | 14 + .../project.xml | 25 ++ .../containerstreesetclear_fuzzer/BUILD.gn | 47 --- .../containerstreesetclear_fuzzer.cpp | 124 ------ .../containerstreesetclear_fuzzer/corpus/init | 14 - .../BUILD.gn | 46 -- .../containerstreesetconstructor_fuzzer.cpp | 120 ------ .../corpus/init | 14 - .../containerstreesetentries_fuzzer/BUILD.gn | 47 --- .../containerstreesetentries_fuzzer.cpp | 124 ------ .../containerstreesetentries_fuzzer.h | 21 - .../corpus/init | 14 - .../containerstreesetforeach_fuzzer/BUILD.gn | 47 --- .../containerstreesetforeach_fuzzer.cpp | 136 ------ .../containerstreesetforeach_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 46 -- .../containerstreesetgetfirstvalue_fuzzer.cpp | 124 ------ .../containerstreesetgetfirstvalue_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 46 -- .../containerstreesetgetlastvalue_fuzzer.cpp | 124 ------ .../containerstreesetgetlastvalue_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 46 -- .../containerstreesetgetlength_fuzzer.cpp | 124 ------ .../containerstreesetgetlength_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containerstreesetisempty_fuzzer/BUILD.gn | 47 --- .../containerstreesetisempty_fuzzer.cpp | 124 ------ .../containerstreesetisempty_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containerstreesetpopfirst_fuzzer/BUILD.gn | 47 --- .../containerstreesetpopfirst_fuzzer.cpp | 124 ------ .../containerstreesetpopfirst_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containerstreesetpoplast_fuzzer/BUILD.gn | 47 --- .../containerstreesetpoplast_fuzzer.cpp | 124 ------ .../containerstreesetpoplast_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containerstreesetvalues_fuzzer/BUILD.gn | 47 --- .../containerstreesetvalues_fuzzer.cpp | 124 ------ .../containerstreesetvalues_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containersvectorclear_fuzzer.h | 21 - .../containersvectorclear_fuzzer/project.xml | 25 -- .../containersvectorclone_fuzzer.h | 21 - .../containersvectorclone_fuzzer/project.xml | 25 -- .../containersvectorcommon_fuzzer.h | 333 +-------------- .../BUILD.gn | 42 -- .../project.xml | 25 -- .../BUILD.gn | 2 +- .../project.xml | 2 +- .../containersvectorforeach_fuzzer/BUILD.gn | 43 -- .../containersvectorforeach_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containersvectorgetcapacity_fuzzer.cpp | 27 -- .../containersvectorgetcapacity_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- ...containersvectorgetfirstelement_fuzzer.cpp | 27 -- .../containersvectorgetfirstelement_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 42 -- .../containersvectorgetlastelement_fuzzer.cpp | 27 -- .../corpus/init | 14 - .../project.xml | 25 -- .../containersvectorisempty_fuzzer/BUILD.gn | 43 -- .../containersvectorisempty_fuzzer.cpp | 27 -- .../containersvectorisempty_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containersvectoriterator_fuzzer/BUILD.gn | 43 -- .../containersvectoriterator_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 42 -- ...tainersvectorreplaceallelements_fuzzer.cpp | 27 -- ...ontainersvectorreplaceallelements_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../containersvectorsort_fuzzer/BUILD.gn | 43 -- .../containersvectorsort_fuzzer.cpp | 27 -- .../containersvectorsort_fuzzer.h | 21 - .../containersvectorsort_fuzzer/corpus/init | 14 - .../containersvectorsort_fuzzer/project.xml | 25 -- .../containersvectortostring_fuzzer/BUILD.gn | 43 -- .../containersvectortostring_fuzzer.h | 21 - .../corpus/init | 14 - .../project.xml | 25 -- .../BUILD.gn | 42 -- ...ainersvectortrimtocurrentlength_fuzzer.cpp | 27 -- .../corpus/init | 14 - .../project.xml | 25 -- test/resource/js_runtime/ohos_test.xml | 47 ++- 157 files changed, 1161 insertions(+), 4944 deletions(-) delete mode 100644 test/fuzztest/containersdequeforeach_fuzzer/BUILD.gn rename test/fuzztest/{containersvectorgetcapacity_fuzzer => containersplainarrayaddhas_fuzzer}/BUILD.gn (83%) rename test/fuzztest/{containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.cpp => containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.cpp} (73%) rename test/fuzztest/{containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.h => containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.h} (77%) rename test/fuzztest/{containersplainarray_fuzzer => containersplainarrayaddhas_fuzzer}/corpus/init (100%) rename test/fuzztest/{containersplainarray_fuzzer => containersplainarrayaddhas_fuzzer}/project.xml (100%) rename test/fuzztest/{containersplainarray_fuzzer/containersplainarray_fuzzer.cpp => containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h} (55%) rename test/fuzztest/{containersplainarray_fuzzer => containersplainarrayget_fuzzer}/BUILD.gn (89%) rename test/fuzztest/{containersvectorclear_fuzzer/containersvectorclear_fuzzer.cpp => containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.cpp} (72%) rename test/fuzztest/{containersplainarray_fuzzer/containersplainarray_fuzzer.h => containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.h} (78%) rename test/fuzztest/{containersvectorclear_fuzzer => containersplainarrayget_fuzzer}/corpus/init (97%) rename test/fuzztest/{containerstreesetclear_fuzzer => containersplainarrayget_fuzzer}/project.xml (97%) create mode 100644 test/fuzztest/containersplainarraygetindexofkey_fuzzer/BUILD.gn create mode 100644 test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.cpp create mode 100644 test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.h rename test/fuzztest/{containersvectorclone_fuzzer => containersplainarraygetindexofkey_fuzzer}/corpus/init (97%) rename test/fuzztest/{containerstreesetconstructor_fuzzer => containersplainarraygetindexofkey_fuzzer}/project.xml (97%) create mode 100644 test/fuzztest/containersplainarraygetindexofvalue_fuzzer/BUILD.gn create mode 100644 test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.cpp rename test/fuzztest/{containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.h => containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.h} (76%) rename test/fuzztest/{containersvectorconverttoarray_fuzzer => containersplainarraygetindexofvalue_fuzzer}/corpus/init (97%) rename test/fuzztest/{containerstreesetentries_fuzzer => containersplainarraygetindexofvalue_fuzzer}/project.xml (97%) rename test/fuzztest/{containersvectorgetfirstelement_fuzzer => containersplainarraygetkeyat_fuzzer}/BUILD.gn (83%) rename test/fuzztest/{containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.cpp => containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.cpp} (73%) rename test/fuzztest/{containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.h => containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.h} (77%) rename test/fuzztest/{containersdequeforeach_fuzzer => containersplainarraygetkeyat_fuzzer}/corpus/init (97%) rename test/fuzztest/{containersdequeforeach_fuzzer => containersplainarraygetkeyat_fuzzer}/project.xml (97%) rename test/fuzztest/{containersvectorclone_fuzzer => containersplainarraygetvalueat_fuzzer}/BUILD.gn (78%) rename test/fuzztest/{containersvectorclone_fuzzer/containersvectorclone_fuzzer.cpp => containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.cpp} (71%) rename test/fuzztest/{containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.h => containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.h} (76%) create mode 100644 test/fuzztest/containersplainarraygetvalueat_fuzzer/corpus/init create mode 100644 test/fuzztest/containersplainarraygetvalueat_fuzzer/project.xml rename test/fuzztest/{containersvectorclear_fuzzer => containersplainarrayremove_fuzzer}/BUILD.gn (79%) rename test/fuzztest/{containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.cpp => containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.cpp} (71%) rename test/fuzztest/{containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.h => containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.h} (77%) create mode 100644 test/fuzztest/containersplainarrayremove_fuzzer/corpus/init create mode 100644 test/fuzztest/containersplainarrayremove_fuzzer/project.xml create mode 100644 test/fuzztest/containersplainarrayremoveat_fuzzer/BUILD.gn rename test/fuzztest/{containersvectortostring_fuzzer/containersvectortostring_fuzzer.cpp => containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.cpp} (73%) create mode 100644 test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.h create mode 100644 test/fuzztest/containersplainarrayremoveat_fuzzer/corpus/init create mode 100644 test/fuzztest/containersplainarrayremoveat_fuzzer/project.xml create mode 100644 test/fuzztest/containersplainarrayremoverangefrom_fuzzer/BUILD.gn create mode 100644 test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.cpp create mode 100644 test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.h create mode 100644 test/fuzztest/containersplainarrayremoverangefrom_fuzzer/corpus/init create mode 100644 test/fuzztest/containersplainarrayremoverangefrom_fuzzer/project.xml create mode 100644 test/fuzztest/containersplainarraysetvalueat_fuzzer/BUILD.gn rename test/fuzztest/{containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.cpp => containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.cpp} (71%) rename test/fuzztest/{containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.h => containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.h} (76%) create mode 100644 test/fuzztest/containersplainarraysetvalueat_fuzzer/corpus/init create mode 100644 test/fuzztest/containersplainarraysetvalueat_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetclear_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetclear_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetconstructor_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetconstructor_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetentries_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetentries_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetforeach_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetforeach_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetforeach_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetgetfirstvalue_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetgetfirstvalue_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetgetfirstvalue_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetgetlastvalue_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetgetlastvalue_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetgetlastvalue_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetgetlength_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetgetlength_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetgetlength_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetisempty_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetisempty_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetisempty_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetpopfirst_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetpopfirst_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetpopfirst_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetpoplast_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetpoplast_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetpoplast_fuzzer/project.xml delete mode 100644 test/fuzztest/containerstreesetvalues_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp delete mode 100644 test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.h delete mode 100644 test/fuzztest/containerstreesetvalues_fuzzer/corpus/init delete mode 100644 test/fuzztest/containerstreesetvalues_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.h delete mode 100644 test/fuzztest/containersvectorclear_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.h delete mode 100644 test/fuzztest/containersvectorclone_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorconverttoarray_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorconverttoarray_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorforeach_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.h delete mode 100644 test/fuzztest/containersvectorforeach_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorforeach_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.h delete mode 100644 test/fuzztest/containersvectorgetcapacity_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorgetcapacity_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.h delete mode 100644 test/fuzztest/containersvectorgetfirstelement_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorgetfirstelement_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorgetlastelement_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorgetlastelement_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorgetlastelement_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorisempty_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.h delete mode 100644 test/fuzztest/containersvectorisempty_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorisempty_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectoriterator_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.h delete mode 100644 test/fuzztest/containersvectoriterator_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectoriterator_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorreplaceallelements_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.h delete mode 100644 test/fuzztest/containersvectorreplaceallelements_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorreplaceallelements_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectorsort_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.h delete mode 100644 test/fuzztest/containersvectorsort_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectorsort_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectortostring_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.h delete mode 100644 test/fuzztest/containersvectortostring_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectortostring_fuzzer/project.xml delete mode 100644 test/fuzztest/containersvectortrimtocurrentlength_fuzzer/BUILD.gn delete mode 100644 test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.cpp delete mode 100644 test/fuzztest/containersvectortrimtocurrentlength_fuzzer/corpus/init delete mode 100644 test/fuzztest/containersvectortrimtocurrentlength_fuzzer/project.xml diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 73637cdb12..7f147ea78f 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -205,6 +205,37 @@ group("fuzztest") { "containerstreemapset_fuzzer:fuzztest", "containerstreemapsetall_fuzzer:fuzztest", "containerstreemapvalues_fuzzer:fuzztest", + "containersdequeinsertfront_fuzzer:fuzztest", + "containerslinkedlistadd_fuzzer:fuzztest", + "containersplainarrayaddhas_fuzzer:fuzztest", + "containersplainarrayget_fuzzer:fuzztest", + "containersplainarraygetindexofkey_fuzzer:fuzztest", + "containersplainarraygetindexofvalue_fuzzer:fuzztest", + "containersplainarraygetkeyat_fuzzer:fuzztest", + "containersplainarrayremove_fuzzer:fuzztest", + "containersplainarrayremoveat_fuzzer:fuzztest", + "containersplainarrayremoverangefrom_fuzzer:fuzztest", + "containersplainarraysetvalueat_fuzzer:fuzztest", + "containersplainarraygetvalueat_fuzzer:fuzztest", + "containerstreesetadd_fuzzer:fuzztest", + "containerstreesetgethighervalue_fuzzer:fuzztest", + "containerstreesetgetlowervalue_fuzzer:fuzztest", + "containerstreesethas_fuzzer:fuzztest", + "containerstreesetremove_fuzzer:fuzztest", + "containersvectoradd_fuzzer:fuzztest", + "containersvectorgetindexfrom_fuzzer:fuzztest", + "containersvectorgetindexof_fuzzer:fuzztest", + "containersvectorgetlastindexfrom_fuzzer:fuzztest", + "containersvectorgetlastindexof_fuzzer:fuzztest", + "containersvectorhas_fuzzer:fuzztest", + "containersvectorinsert_fuzzer:fuzztest", + "containersvectorremove_fuzzer:fuzztest", + "containersvectorremovebyrange_fuzzer:fuzztest", + "containersvectorset_fuzzer:fuzztest", + "containersvectorsubvector_fuzzer:fuzztest", + "containersvectorcopytoarray_fuzzer:fuzztest", + "containersvectorincreasecapacityto_fuzzer:fuzztest", + "containersvectorsetlength_fuzzer:fuzztest", "copyableglobalisempty_fuzzer:fuzztest", "copyableglobalsetandclearweak_fuzzer:fuzztest", "createbigwords_fuzzer:fuzztest", diff --git a/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h b/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h index f6d175ae22..30c1ff222a 100644 --- a/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h +++ b/test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h @@ -121,50 +121,6 @@ public: } }; - static void ContainersDequeForEachFuzzTest(const uint8_t* data, size_t size) - { - uint32_t input = 0; - if (size <= 0) { - return; - } - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&input, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - constexpr uint32_t NODE_NUMBERS = 8; - JSHandle deque = CreateJSAPIDeque(thread); - for (uint32_t i = 0; i < NODE_NUMBERS; i++) { - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 8); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(deque.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(i + input)); - ContainersDeque::InsertFront(callInfo); - } - - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle func = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, - reinterpret_cast(TestClass::TestForEachFunc)); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 8); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(deque.GetTaggedValue()); - callInfo->SetCallArg(0, func.GetTaggedValue()); - callInfo->SetCallArg(1, deque.GetTaggedValue()); - ContainersDeque::ForEach(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersDequeGetFirstFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; diff --git a/test/fuzztest/containersdequeforeach_fuzzer/BUILD.gn b/test/fuzztest/containersdequeforeach_fuzzer/BUILD.gn deleted file mode 100644 index c57b04965d..0000000000 --- a/test/fuzztest/containersdequeforeach_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersDequeForEachFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersdequeforeach_fuzzer" - - sources = [ "containersdequeforeach_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersDequeForEachFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorgetcapacity_fuzzer/BUILD.gn b/test/fuzztest/containersplainarrayaddhas_fuzzer/BUILD.gn similarity index 83% rename from test/fuzztest/containersvectorgetcapacity_fuzzer/BUILD.gn rename to test/fuzztest/containersplainarrayaddhas_fuzzer/BUILD.gn index b3a8d9f889..a7ce806e6b 100644 --- a/test/fuzztest/containersvectorgetcapacity_fuzzer/BUILD.gn +++ b/test/fuzztest/containersplainarrayaddhas_fuzzer/BUILD.gn @@ -18,15 +18,16 @@ import("//build/config/features.gni") import("//build/ohos.gni") ##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorGetCapacityFuzzTest") { +ohos_fuzztest("ContainersPlainArrayAddHasFuzzTest") { module_out_path = ets_runtime_output_path - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectorgetcapacity_fuzzer" + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarrayaddhas_fuzzer" resource_config_file = "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - sources = [ "containersvectorgetcapacity_fuzzer.cpp" ] + sources = [ "containersplainarrayaddhas_fuzzer.cpp" ] configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] @@ -41,5 +42,5 @@ ohos_fuzztest("ContainersVectorGetCapacityFuzzTest") { group("fuzztest") { testonly = true deps = [] - deps += [ ":ContainersVectorGetCapacityFuzzTest" ] + deps += [ ":ContainersPlainArrayAddHasFuzzTest" ] } diff --git a/test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.cpp b/test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.cpp similarity index 73% rename from test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.cpp rename to test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.cpp index 6de2384464..bc39872244 100644 --- a/test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.cpp +++ b/test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorforeach_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorForEachFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarrayaddhas_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_Add_Has_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.h b/test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.h similarity index 77% rename from test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.h rename to test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.h index f97e5a680a..729eda3ba0 100644 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.h +++ b/test/fuzztest/containersplainarrayaddhas_fuzzer/containersplainarrayaddhas_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETCONSTRUCTOR_FUZZER_H -#define CONTAINERSTREESETCONSTRUCTOR_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetconstructor_fuzzer.h" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_ADDHAS_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_ADDHAS_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarrayaddhas_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarray_fuzzer/corpus/init b/test/fuzztest/containersplainarrayaddhas_fuzzer/corpus/init similarity index 100% rename from test/fuzztest/containersplainarray_fuzzer/corpus/init rename to test/fuzztest/containersplainarrayaddhas_fuzzer/corpus/init diff --git a/test/fuzztest/containersplainarray_fuzzer/project.xml b/test/fuzztest/containersplainarrayaddhas_fuzzer/project.xml similarity index 100% rename from test/fuzztest/containersplainarray_fuzzer/project.xml rename to test/fuzztest/containersplainarrayaddhas_fuzzer/project.xml diff --git a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp b/test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h similarity index 55% rename from test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp rename to test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h index 14763537ac..92a4d87d7f 100644 --- a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.cpp +++ b/test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#include "containersplainarray_fuzzer.h" +#ifndef CONTAINERS_PLAIN_ARRAY_COMMON_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_COMMON_FUZZER_H #include "ecmascript/base/builtins_base.h" #include "ecmascript/containers/containers_plainarray.h" @@ -25,19 +25,21 @@ #include "ecmascript/js_handle.h" #include "ecmascript/napi/include/jsnapi.h" +namespace ContainersPlainArrayFuzzTest { using namespace panda; using namespace panda::ecmascript; using namespace panda::ecmascript::base; using namespace panda::ecmascript::containers; -namespace OHOS { - JSFunction *JSObjectCreate(JSThread *thread) +class ContainersPlainArrayTest { +public: + static JSFunction *JSObjectCreate(JSThread *thread) { JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); return globalEnv->GetObjectFunction().GetObject(); } - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) + static EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) { auto factory = thread->GetEcmaVM()->GetFactory(); JSHandle hclass(thread, JSObjectCreate(thread)); @@ -48,7 +50,7 @@ namespace OHOS { return objCallInfo; } - JSTaggedValue InitializePlainArrayConstructor(JSThread *thread) + static JSTaggedValue InitializePlainArrayConstructor(JSThread *thread) { auto factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); @@ -65,7 +67,7 @@ namespace OHOS { return result; } - JSHandle CreateJSAPIPlainArray(JSThread *thread) + static JSHandle CreateJSAPIPlainArray(JSThread *thread) { JSHandle newTarget(thread, InitializePlainArrayConstructor(thread)); auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); @@ -77,38 +79,7 @@ namespace OHOS { return array; } - void ContainersPlainArray_Constructor_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - uint32_t input = 0; - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&input, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 6); // 6 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(input)); - ContainersPlainArray::PlainArrayConstructor(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_Add_Has_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_Add_Has_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -155,89 +126,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_Clone_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForClone = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForClone->SetFunction(JSTaggedValue::Undefined()); - cfForClone->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::Clone(cfForClone); // expected to return new plain array - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_Clear_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForClear = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForClear->SetFunction(JSTaggedValue::Undefined()); - cfForClear->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::Clear(cfForClear); // expected to return true - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_Get_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_Get_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -279,147 +168,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_GetIteratorObj_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForGetIteratorObj = - CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForGetIteratorObj->SetFunction(JSTaggedValue::Undefined()); - cfForGetIteratorObj->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::GetIteratorObj(cfForGetIteratorObj); // expected to return iterator - } - JSNApi::DestroyJSVM(vm); - } - - static JSTaggedValue TestForEachFunc(EcmaRuntimeCallInfo *argv) - { - JSThread *thread = argv->GetThread(); - JSHandle key = BuiltinsBase::GetCallArg(argv, 0); // 0 means the value - JSHandle value = BuiltinsBase::GetCallArg(argv, 1); // 1 means the value - JSHandle plainArray(BuiltinsBase::GetCallArg(argv, 2)); // 2 means the value - JSHandle newValue(thread, value.GetTaggedValue()); - JSAPIPlainArray::Add(thread, plainArray, key, newValue); - return JSTaggedValue::True(); - } - - void ContainersPlainArray_ForEach_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - JSHandle env = vm->GetGlobalEnv(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - JSHandle thisArg = CreateJSAPIPlainArray(thread); - JSHandle cbFunc = factory->NewJSFunction(env, reinterpret_cast(TestForEachFunc)); - EcmaRuntimeCallInfo *cfForForEach = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - cfForForEach->SetFunction(JSTaggedValue::Undefined()); - cfForForEach->SetThis(plainArray.GetTaggedValue()); - cfForForEach->SetCallArg(0, cbFunc.GetTaggedValue()); - cfForForEach->SetCallArg(1, thisArg.GetTaggedValue()); - ContainersPlainArray::ForEach(cfForForEach); // expected to return undefined - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_ToString_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForToString = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForToString->SetFunction(JSTaggedValue::Undefined()); - cfForToString->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::ToString(cfForToString); // expected to return string object - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_GetIndexOfKey_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_GetIndexOfKey_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -462,7 +211,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_GetIndexOfValue_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_GetIndexOfValue_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -505,48 +254,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_IsEmpty_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForIsEmpty = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForIsEmpty->SetFunction(JSTaggedValue::Undefined()); - cfForIsEmpty->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::IsEmpty(cfForIsEmpty); // expected to return true or false - } - JSNApi::DestroyJSVM(vm); - } - - void ContainersPlainArray_GetKeyAt_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_GetKeyAt_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -588,7 +296,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_Remove_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_Remove_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -630,7 +338,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_RemoveAt_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_RemoveAt_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -672,7 +380,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_RemoveRangeFrom_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_RemoveRangeFrom_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -716,7 +424,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_SetValueAt_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_SetValueAt_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -759,7 +467,7 @@ namespace OHOS { JSNApi::DestroyJSVM(vm); } - void ContainersPlainArray_GetValueAt_FuzzTest(const uint8_t* data, size_t size) + static void ContainersPlainArray_GetValueAt_FuzzTest(const uint8_t* data, size_t size) { if (data == nullptr || size <= 0) { std::cout << "illegal input!"; @@ -800,70 +508,7 @@ namespace OHOS { } JSNApi::DestroyJSVM(vm); } - - void ContainersPlainArray_GetSize_FuzzTest(const uint8_t* data, size_t size) - { - if (data == nullptr || size <= 0) { - std::cout << "illegal input!"; - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - auto factory = vm->GetFactory(); - - uint32_t inputNum = 0; - std::string inputStr(data, data + size); - const uint32_t MAXBYTELEN = 4; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; - } - if (memcpy_s(&inputNum, MAXBYTELEN, data, size) != 0) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - JSHandle plainArray = CreateJSAPIPlainArray(thread); - JSHandle inputEcmaStr = factory->NewFromStdString(inputStr); - EcmaRuntimeCallInfo *callInfo = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(plainArray.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(static_cast(inputNum))); - callInfo->SetCallArg(1, inputEcmaStr.GetTaggedValue()); - ContainersPlainArray::Add(callInfo); - - EcmaRuntimeCallInfo *cfForGetSize = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - cfForGetSize->SetFunction(JSTaggedValue::Undefined()); - cfForGetSize->SetThis(plainArray.GetTaggedValue()); - ContainersPlainArray::GetSize(cfForGetSize); // expected to return the size - } - JSNApi::DestroyJSVM(vm); - } +}; } -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersPlainArray_Constructor_FuzzTest(data, size); - OHOS::ContainersPlainArray_Add_Has_FuzzTest(data, size); - OHOS::ContainersPlainArray_Clone_FuzzTest(data, size); - OHOS::ContainersPlainArray_Clear_FuzzTest(data, size); - OHOS::ContainersPlainArray_Get_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetIteratorObj_FuzzTest(data, size); - OHOS::ContainersPlainArray_ForEach_FuzzTest(data, size); - OHOS::ContainersPlainArray_ToString_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetIndexOfKey_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetIndexOfValue_FuzzTest(data, size); - OHOS::ContainersPlainArray_IsEmpty_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetKeyAt_FuzzTest(data, size); - OHOS::ContainersPlainArray_Remove_FuzzTest(data, size); - OHOS::ContainersPlainArray_RemoveAt_FuzzTest(data, size); - OHOS::ContainersPlainArray_RemoveRangeFrom_FuzzTest(data, size); - OHOS::ContainersPlainArray_SetValueAt_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetValueAt_FuzzTest(data, size); - OHOS::ContainersPlainArray_GetSize_FuzzTest(data, size); - return 0; -} \ No newline at end of file +#endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarray_fuzzer/BUILD.gn b/test/fuzztest/containersplainarrayget_fuzzer/BUILD.gn similarity index 89% rename from test/fuzztest/containersplainarray_fuzzer/BUILD.gn rename to test/fuzztest/containersplainarrayget_fuzzer/BUILD.gn index 466a6bc982..a92c13896c 100644 --- a/test/fuzztest/containersplainarray_fuzzer/BUILD.gn +++ b/test/fuzztest/containersplainarrayget_fuzzer/BUILD.gn @@ -18,16 +18,16 @@ import("//build/config/features.gni") import("//build/ohos.gni") ##################################fuzztest##################################### -ohos_fuzztest("ContainersPlainArrayFuzzTest") { +ohos_fuzztest("ContainersPlainArrayGetFuzzTest") { module_out_path = ets_runtime_output_path fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersplainarray_fuzzer" + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarrayget_fuzzer" resource_config_file = "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - sources = [ "containersplainarray_fuzzer.cpp" ] + sources = [ "containersplainarrayget_fuzzer.cpp" ] configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] @@ -42,5 +42,5 @@ ohos_fuzztest("ContainersPlainArrayFuzzTest") { group("fuzztest") { testonly = true deps = [] - deps += [ ":ContainersPlainArrayFuzzTest" ] + deps += [ ":ContainersPlainArrayGetFuzzTest" ] } diff --git a/test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.cpp b/test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.cpp similarity index 72% rename from test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.cpp rename to test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.cpp index 98b08d7413..42e6970f56 100644 --- a/test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.cpp +++ b/test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorclear_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorClearFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarrayget_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_Get_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.h b/test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.h similarity index 78% rename from test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.h rename to test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.h index 6f249f5a28..59294c5291 100644 --- a/test/fuzztest/containersplainarray_fuzzer/containersplainarray_fuzzer.h +++ b/test/fuzztest/containersplainarrayget_fuzzer/containersplainarrayget_fuzzer.h @@ -13,9 +13,9 @@ * limitations under the License. */ -#ifndef CONTAINERS_PLAIN_ARRAY_FUZZER_H -#define CONTAINERS_PLAIN_ARRAY_FUZZER_H +#ifndef CONTAINERS_PLAIN_ARRAY_GET_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_GET_FUZZER_H -#define FUZZ_PROJECT_NAME "containersplainarray_fuzzer" +#define FUZZ_PROJECT_NAME "containersplainarrayget_fuzzer" #endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorclear_fuzzer/corpus/init b/test/fuzztest/containersplainarrayget_fuzzer/corpus/init similarity index 97% rename from test/fuzztest/containersvectorclear_fuzzer/corpus/init rename to test/fuzztest/containersplainarrayget_fuzzer/corpus/init index d175fac243..d778599a0f 100644 --- a/test/fuzztest/containersvectorclear_fuzzer/corpus/init +++ b/test/fuzztest/containersplainarrayget_fuzzer/corpus/init @@ -1,14 +1,14 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetclear_fuzzer/project.xml b/test/fuzztest/containersplainarrayget_fuzzer/project.xml similarity index 97% rename from test/fuzztest/containerstreesetclear_fuzzer/project.xml rename to test/fuzztest/containersplainarrayget_fuzzer/project.xml index 6e8ad2cfde..1020c7b430 100644 --- a/test/fuzztest/containerstreesetclear_fuzzer/project.xml +++ b/test/fuzztest/containersplainarrayget_fuzzer/project.xml @@ -1,25 +1,25 @@ - - - - - - 1000 - - 300 - - 4096 - - + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersplainarraygetindexofkey_fuzzer/BUILD.gn b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/BUILD.gn new file mode 100644 index 0000000000..e3253e69af --- /dev/null +++ b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +##################################hydra-fuzz################################### +import("//arkcompiler/ets_runtime/js_runtime_config.gni") +import("//arkcompiler/ets_runtime/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ContainersPlainArrayGetIndexOfKeyFuzzTest") { + module_out_path = ets_runtime_output_path + + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarraygetindexofkey_fuzzer" + + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarraygetindexofkey_fuzzer.cpp" ] + + configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] + + deps = [ "../../../:libark_jsruntime_test" ] + + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + external_deps += [ sdk_libc_secshared_dep ] + deps += hiviewdfx_deps +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ContainersPlainArrayGetIndexOfKeyFuzzTest" ] +} diff --git a/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.cpp b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.cpp new file mode 100644 index 0000000000..9fdeb1b92d --- /dev/null +++ b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarraygetindexofkey_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_GetIndexOfKey_FuzzTest(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.h b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.h new file mode 100644 index 0000000000..71fd8a3c46 --- /dev/null +++ b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/containersplainarraygetindexofkey_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_GETINDEXOFKEY_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_GETINDEXOFKEY_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarraygetindexofkey_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorclone_fuzzer/corpus/init b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/corpus/init similarity index 97% rename from test/fuzztest/containersvectorclone_fuzzer/corpus/init rename to test/fuzztest/containersplainarraygetindexofkey_fuzzer/corpus/init index d175fac243..d778599a0f 100644 --- a/test/fuzztest/containersvectorclone_fuzzer/corpus/init +++ b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/corpus/init @@ -1,14 +1,14 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/project.xml b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/project.xml similarity index 97% rename from test/fuzztest/containerstreesetconstructor_fuzzer/project.xml rename to test/fuzztest/containersplainarraygetindexofkey_fuzzer/project.xml index 6e8ad2cfde..1020c7b430 100644 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/project.xml +++ b/test/fuzztest/containersplainarraygetindexofkey_fuzzer/project.xml @@ -1,25 +1,25 @@ - - - - - - 1000 - - 300 - - 4096 - - + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/BUILD.gn b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/BUILD.gn new file mode 100644 index 0000000000..3ba176b470 --- /dev/null +++ b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +##################################hydra-fuzz################################### +import("//arkcompiler/ets_runtime/js_runtime_config.gni") +import("//arkcompiler/ets_runtime/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ContainersPlainArrayGetIndexOfValueFuzzTest") { + module_out_path = ets_runtime_output_path + + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarraygetindexofvalue_fuzzer" + + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarraygetindexofvalue_fuzzer.cpp" ] + + configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] + + deps = [ "../../../:libark_jsruntime_test" ] + + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + external_deps += [ sdk_libc_secshared_dep ] + deps += hiviewdfx_deps +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ContainersPlainArrayGetIndexOfValueFuzzTest" ] +} diff --git a/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.cpp b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.cpp new file mode 100644 index 0000000000..809c8b9310 --- /dev/null +++ b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarraygetindexofvalue_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_GetIndexOfValue_FuzzTest(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.h b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.h similarity index 76% rename from test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.h rename to test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.h index 332666c9ef..39c924ecde 100644 --- a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.h +++ b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/containersplainarraygetindexofvalue_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORTRIMTOCURRENTLENGTH_FUZZER_H -#define CONTAINERSVECTORTRIMTOCURRENTLENGTH_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectortrimtocurrentlength_fuzzer" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_GETINDEXOFVALUE_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_GETINDEXOFVALUE_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarraygetindexofvalue_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorconverttoarray_fuzzer/corpus/init b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/corpus/init similarity index 97% rename from test/fuzztest/containersvectorconverttoarray_fuzzer/corpus/init rename to test/fuzztest/containersplainarraygetindexofvalue_fuzzer/corpus/init index d175fac243..d778599a0f 100644 --- a/test/fuzztest/containersvectorconverttoarray_fuzzer/corpus/init +++ b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/corpus/init @@ -1,14 +1,14 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetentries_fuzzer/project.xml b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/project.xml similarity index 97% rename from test/fuzztest/containerstreesetentries_fuzzer/project.xml rename to test/fuzztest/containersplainarraygetindexofvalue_fuzzer/project.xml index 6e8ad2cfde..1020c7b430 100644 --- a/test/fuzztest/containerstreesetentries_fuzzer/project.xml +++ b/test/fuzztest/containersplainarraygetindexofvalue_fuzzer/project.xml @@ -1,25 +1,25 @@ - - - - - - 1000 - - 300 - - 4096 - - + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersvectorgetfirstelement_fuzzer/BUILD.gn b/test/fuzztest/containersplainarraygetkeyat_fuzzer/BUILD.gn similarity index 83% rename from test/fuzztest/containersvectorgetfirstelement_fuzzer/BUILD.gn rename to test/fuzztest/containersplainarraygetkeyat_fuzzer/BUILD.gn index e41353878d..e13063b93a 100644 --- a/test/fuzztest/containersvectorgetfirstelement_fuzzer/BUILD.gn +++ b/test/fuzztest/containersplainarraygetkeyat_fuzzer/BUILD.gn @@ -18,15 +18,16 @@ import("//build/config/features.gni") import("//build/ohos.gni") ##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorGetFirstElementFuzzTest") { +ohos_fuzztest("ContainersPlainArrayGetKeyAtFuzzTest") { module_out_path = ets_runtime_output_path - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectorgetfirstelement_fuzzer" + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarraygetkeyat_fuzzer" resource_config_file = "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - sources = [ "containersvectorgetfirstelement_fuzzer.cpp" ] + sources = [ "containersplainarraygetkeyat_fuzzer.cpp" ] configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] @@ -41,5 +42,5 @@ ohos_fuzztest("ContainersVectorGetFirstElementFuzzTest") { group("fuzztest") { testonly = true deps = [] - deps += [ ":ContainersVectorGetFirstElementFuzzTest" ] + deps += [ ":ContainersPlainArrayGetKeyAtFuzzTest" ] } diff --git a/test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.cpp b/test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.cpp similarity index 73% rename from test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.cpp rename to test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.cpp index b24252bb49..f88ce85921 100644 --- a/test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.cpp +++ b/test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectoriterator_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorIteratorFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarraygetkeyat_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_GetKeyAt_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.h b/test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.h similarity index 77% rename from test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.h rename to test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.h index fd4efadf89..f36955ba17 100644 --- a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.h +++ b/test/fuzztest/containersplainarraygetkeyat_fuzzer/containersplainarraygetkeyat_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETCLEAR_FUZZER_H -#define CONTAINERSTREESETCLEAR_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetclear_fuzzer.h" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_GETKEYAT_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_GETKEYAT_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarraygetkeyat_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersdequeforeach_fuzzer/corpus/init b/test/fuzztest/containersplainarraygetkeyat_fuzzer/corpus/init similarity index 97% rename from test/fuzztest/containersdequeforeach_fuzzer/corpus/init rename to test/fuzztest/containersplainarraygetkeyat_fuzzer/corpus/init index d175fac243..d778599a0f 100644 --- a/test/fuzztest/containersdequeforeach_fuzzer/corpus/init +++ b/test/fuzztest/containersplainarraygetkeyat_fuzzer/corpus/init @@ -1,14 +1,14 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersdequeforeach_fuzzer/project.xml b/test/fuzztest/containersplainarraygetkeyat_fuzzer/project.xml similarity index 97% rename from test/fuzztest/containersdequeforeach_fuzzer/project.xml rename to test/fuzztest/containersplainarraygetkeyat_fuzzer/project.xml index 6e8ad2cfde..1020c7b430 100644 --- a/test/fuzztest/containersdequeforeach_fuzzer/project.xml +++ b/test/fuzztest/containersplainarraygetkeyat_fuzzer/project.xml @@ -1,25 +1,25 @@ - - - - - - 1000 - - 300 - - 4096 - - + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersvectorclone_fuzzer/BUILD.gn b/test/fuzztest/containersplainarraygetvalueat_fuzzer/BUILD.gn similarity index 78% rename from test/fuzztest/containersvectorclone_fuzzer/BUILD.gn rename to test/fuzztest/containersplainarraygetvalueat_fuzzer/BUILD.gn index a388786497..79447a75da 100644 --- a/test/fuzztest/containersvectorclone_fuzzer/BUILD.gn +++ b/test/fuzztest/containersplainarraygetvalueat_fuzzer/BUILD.gn @@ -18,13 +18,16 @@ import("//build/config/features.gni") import("//build/ohos.gni") ##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorCloneFuzzTest") { +ohos_fuzztest("ContainersPlainArrayGetValueAtFuzzTest") { module_out_path = ets_runtime_output_path fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectorclone_fuzzer" + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarraygetvalueat_fuzzer" - sources = [ "containersvectorclone_fuzzer.cpp" ] + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarraygetvalueat_fuzzer.cpp" ] configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] @@ -39,5 +42,5 @@ ohos_fuzztest("ContainersVectorCloneFuzzTest") { group("fuzztest") { testonly = true deps = [] - deps += [ ":ContainersVectorCloneFuzzTest" ] + deps += [ ":ContainersPlainArrayGetValueAtFuzzTest" ] } diff --git a/test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.cpp b/test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.cpp similarity index 71% rename from test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.cpp rename to test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.cpp index cb0dcf77e7..e153d07149 100644 --- a/test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.cpp +++ b/test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorclone_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorCloneFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarraygetvalueat_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_GetValueAt_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.h b/test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.h similarity index 76% rename from test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.h rename to test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.h index 3bc2f6386c..0e742d5925 100644 --- a/test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.h +++ b/test/fuzztest/containersplainarraygetvalueat_fuzzer/containersplainarraygetvalueat_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORCONVERTTOARRAY_FUZZER_H -#define CONTAINERSVECTORCONVERTTOARRAY_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorconverttoarray_fuzzer" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_GETVALUEAT_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_GETVALUEAT_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarraygetvalueat_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarraygetvalueat_fuzzer/corpus/init b/test/fuzztest/containersplainarraygetvalueat_fuzzer/corpus/init new file mode 100644 index 0000000000..d778599a0f --- /dev/null +++ b/test/fuzztest/containersplainarraygetvalueat_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersplainarraygetvalueat_fuzzer/project.xml b/test/fuzztest/containersplainarraygetvalueat_fuzzer/project.xml new file mode 100644 index 0000000000..1020c7b430 --- /dev/null +++ b/test/fuzztest/containersplainarraygetvalueat_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersvectorclear_fuzzer/BUILD.gn b/test/fuzztest/containersplainarrayremove_fuzzer/BUILD.gn similarity index 79% rename from test/fuzztest/containersvectorclear_fuzzer/BUILD.gn rename to test/fuzztest/containersplainarrayremove_fuzzer/BUILD.gn index 8cfb820eff..e11bcc0149 100644 --- a/test/fuzztest/containersvectorclear_fuzzer/BUILD.gn +++ b/test/fuzztest/containersplainarrayremove_fuzzer/BUILD.gn @@ -18,13 +18,16 @@ import("//build/config/features.gni") import("//build/ohos.gni") ##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorClearFuzzTest") { +ohos_fuzztest("ContainersPlainArrayRemoveFuzzTest") { module_out_path = ets_runtime_output_path fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectorclear_fuzzer" + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarrayremove_fuzzer" - sources = [ "containersvectorclear_fuzzer.cpp" ] + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarrayremove_fuzzer.cpp" ] configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] @@ -39,5 +42,5 @@ ohos_fuzztest("ContainersVectorClearFuzzTest") { group("fuzztest") { testonly = true deps = [] - deps += [ ":ContainersVectorClearFuzzTest" ] + deps += [ ":ContainersPlainArrayRemoveFuzzTest" ] } diff --git a/test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.cpp b/test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.cpp similarity index 71% rename from test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.cpp rename to test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.cpp index a19048f0ea..e8cdd5742d 100644 --- a/test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.cpp +++ b/test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersdequeforeach_fuzzer.h" -#include "test/fuzztest/containersdequecommon_fuzzer/containersdequecommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersDequeFuzzTestHelper::ContainersDequeForEachFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarrayremove_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_Remove_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.h b/test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.h similarity index 77% rename from test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.h rename to test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.h index ca2b7d8557..ddc0af2de1 100644 --- a/test/fuzztest/containersdequeforeach_fuzzer/containersdequeforeach_fuzzer.h +++ b/test/fuzztest/containersplainarrayremove_fuzzer/containersplainarrayremove_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSDEQUEFOREACH_FUZZER_H -#define CONTAINERSDEQUEFOREACH_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersdequeforeach_fuzzer" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_REMOVE_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_REMOVE_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarrayremove_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremove_fuzzer/corpus/init b/test/fuzztest/containersplainarrayremove_fuzzer/corpus/init new file mode 100644 index 0000000000..d778599a0f --- /dev/null +++ b/test/fuzztest/containersplainarrayremove_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremove_fuzzer/project.xml b/test/fuzztest/containersplainarrayremove_fuzzer/project.xml new file mode 100644 index 0000000000..1020c7b430 --- /dev/null +++ b/test/fuzztest/containersplainarrayremove_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersplainarrayremoveat_fuzzer/BUILD.gn b/test/fuzztest/containersplainarrayremoveat_fuzzer/BUILD.gn new file mode 100644 index 0000000000..cc358dc332 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoveat_fuzzer/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +##################################hydra-fuzz################################### +import("//arkcompiler/ets_runtime/js_runtime_config.gni") +import("//arkcompiler/ets_runtime/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ContainersPlainArrayRemoveAtFuzzTest") { + module_out_path = ets_runtime_output_path + + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarrayremoveat_fuzzer" + + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarrayremoveat_fuzzer.cpp" ] + + configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] + + deps = [ "../../../:libark_jsruntime_test" ] + + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + external_deps += [ sdk_libc_secshared_dep ] + deps += hiviewdfx_deps +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ContainersPlainArrayRemoveAtFuzzTest" ] +} diff --git a/test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.cpp b/test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.cpp similarity index 73% rename from test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.cpp rename to test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.cpp index bb0bff7a46..d3965382f6 100644 --- a/test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.cpp +++ b/test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectortostring_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorToStringFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarrayremoveat_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_RemoveAt_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.h b/test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.h new file mode 100644 index 0000000000..a942fa9359 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoveat_fuzzer/containersplainarrayremoveat_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_REMOVEAT_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_REMOVEAT_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarrayremoveat_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoveat_fuzzer/corpus/init b/test/fuzztest/containersplainarrayremoveat_fuzzer/corpus/init new file mode 100644 index 0000000000..d778599a0f --- /dev/null +++ b/test/fuzztest/containersplainarrayremoveat_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoveat_fuzzer/project.xml b/test/fuzztest/containersplainarrayremoveat_fuzzer/project.xml new file mode 100644 index 0000000000..1020c7b430 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoveat_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/BUILD.gn b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/BUILD.gn new file mode 100644 index 0000000000..329b781533 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +##################################hydra-fuzz################################### +import("//arkcompiler/ets_runtime/js_runtime_config.gni") +import("//arkcompiler/ets_runtime/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ContainersPlainArrayRemoveRangeFromFuzzTest") { + module_out_path = ets_runtime_output_path + + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarrayremoverangefrom_fuzzer" + + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarrayremoverangefrom_fuzzer.cpp" ] + + configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] + + deps = [ "../../../:libark_jsruntime_test" ] + + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + external_deps += [ sdk_libc_secshared_dep ] + deps += hiviewdfx_deps +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ContainersPlainArrayRemoveRangeFromFuzzTest" ] +} diff --git a/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.cpp b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.cpp new file mode 100644 index 0000000000..0d7b7c6667 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarrayremoverangefrom_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_RemoveRangeFrom_FuzzTest(data, size); + return 0; +} \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.h b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.h new file mode 100644 index 0000000000..8273baef4f --- /dev/null +++ b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/containersplainarrayremoverangefrom_fuzzer.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_REMOVERANGEFROM_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_REMOVERANGEFROM_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarrayremoverangefrom_fuzzer" + +#endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/corpus/init b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/corpus/init new file mode 100644 index 0000000000..d778599a0f --- /dev/null +++ b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/project.xml b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/project.xml new file mode 100644 index 0000000000..1020c7b430 --- /dev/null +++ b/test/fuzztest/containersplainarrayremoverangefrom_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containersplainarraysetvalueat_fuzzer/BUILD.gn b/test/fuzztest/containersplainarraysetvalueat_fuzzer/BUILD.gn new file mode 100644 index 0000000000..3ff04eff73 --- /dev/null +++ b/test/fuzztest/containersplainarraysetvalueat_fuzzer/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +##################################hydra-fuzz################################### +import("//arkcompiler/ets_runtime/js_runtime_config.gni") +import("//arkcompiler/ets_runtime/test/test_helper.gni") +import("//build/config/features.gni") +import("//build/ohos.gni") + +##################################fuzztest##################################### +ohos_fuzztest("ContainersPlainArraySetValueAtFuzzTest") { + module_out_path = ets_runtime_output_path + + fuzz_config_file = + "//arkcompiler/ets_runtime/test/fuzztest/containersplainarraysetvalueat_fuzzer" + + resource_config_file = + "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" + + sources = [ "containersplainarraysetvalueat_fuzzer.cpp" ] + + configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] + + deps = [ "../../../:libark_jsruntime_test" ] + + # hiviewdfx libraries + external_deps = hiviewdfx_ext_deps + external_deps += [ sdk_libc_secshared_dep ] + deps += hiviewdfx_deps +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ContainersPlainArraySetValueAtFuzzTest" ] +} diff --git a/test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.cpp b/test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.cpp similarity index 71% rename from test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.cpp rename to test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.cpp index 5b7e25a775..45372871d0 100644 --- a/test/fuzztest/containersvectorconverttoarray_fuzzer/containersvectorconverttoarray_fuzzer.cpp +++ b/test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.cpp @@ -1,27 +1,27 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorconverttoarray_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorConvertToArrayFuzzTest(data, size); - return 0; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 "containersplainarraysetvalueat_fuzzer.h" +#include "test/fuzztest/containersplainarraycommon_fuzzer/containersplainarraycommon_fuzzer.h" + +using namespace ContainersPlainArrayFuzzTest; + +// Fuzzer entry point. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + // Run your code on data. + ContainersPlainArrayTest::ContainersPlainArray_SetValueAt_FuzzTest(data, size); + return 0; } \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.h b/test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.h similarity index 76% rename from test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.h rename to test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.h index 098273ff71..c1c6c5ee1f 100644 --- a/test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.h +++ b/test/fuzztest/containersplainarraysetvalueat_fuzzer/containersplainarraysetvalueat_fuzzer.h @@ -1,21 +1,21 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORGETLASTELEMENT_FUZZER_H -#define CONTAINERSVECTORGETLASTELEMENT_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorgetlastelement_fuzzer" - +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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. + */ + +#ifndef CONTAINERS_PLAIN_ARRAY_SETVALUEAT_FUZZER_H +#define CONTAINERS_PLAIN_ARRAY_SETVALUEAT_FUZZER_H + +#define FUZZ_PROJECT_NAME "containersplainarraysetvalueat_fuzzer" + #endif \ No newline at end of file diff --git a/test/fuzztest/containersplainarraysetvalueat_fuzzer/corpus/init b/test/fuzztest/containersplainarraysetvalueat_fuzzer/corpus/init new file mode 100644 index 0000000000..d778599a0f --- /dev/null +++ b/test/fuzztest/containersplainarraysetvalueat_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersplainarraysetvalueat_fuzzer/project.xml b/test/fuzztest/containersplainarraysetvalueat_fuzzer/project.xml new file mode 100644 index 0000000000..1020c7b430 --- /dev/null +++ b/test/fuzztest/containersplainarraysetvalueat_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/containerstreesetclear_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetclear_fuzzer/BUILD.gn deleted file mode 100644 index 28d55a4574..0000000000 --- a/test/fuzztest/containerstreesetclear_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetClearFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetclear_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetclear_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetClearFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp b/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp deleted file mode 100644 index e6f6e6ea03..0000000000 --- a/test/fuzztest/containerstreesetclear_fuzzer/containerstreesetclear_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetclear_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetClearFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::Clear(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetClearFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetclear_fuzzer/corpus/init b/test/fuzztest/containerstreesetclear_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetclear_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetconstructor_fuzzer/BUILD.gn deleted file mode 100644 index 34ad9537e8..0000000000 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/BUILD.gn +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetConstructorFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetconstructor_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetconstructor_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetConstructorFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp b/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp deleted file mode 100644 index 81f2410276..0000000000 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/containerstreesetconstructor_fuzzer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetconstructor_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetConstructorFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - - ContainersTreeSet::TreeSetConstructor(callInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetConstructorFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetconstructor_fuzzer/corpus/init b/test/fuzztest/containerstreesetconstructor_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetconstructor_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetentries_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetentries_fuzzer/BUILD.gn deleted file mode 100644 index 6e29617c36..0000000000 --- a/test/fuzztest/containerstreesetentries_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetEntriesFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetentries_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetentries_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetEntriesFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp b/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp deleted file mode 100644 index cefb8c5974..0000000000 --- a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetentries_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetEntriesFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::Entries(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetEntriesFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.h b/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.h deleted file mode 100644 index 91226e303c..0000000000 --- a/test/fuzztest/containerstreesetentries_fuzzer/containerstreesetentries_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETENTRIES_FUZZER_H -#define CONTAINERSTREESETENTRIES_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetentries_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetentries_fuzzer/corpus/init b/test/fuzztest/containerstreesetentries_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetentries_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetforeach_fuzzer/BUILD.gn deleted file mode 100644 index ff1b8ac203..0000000000 --- a/test/fuzztest/containerstreesetforeach_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetForEachFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetforeach_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetforeach_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetForEachFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp b/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp deleted file mode 100644 index 64aa345030..0000000000 --- a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetforeach_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" -#include "ecmascript/object_factory.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - JSTaggedValue TestForEachFunc([[maybe_unused]] EcmaRuntimeCallInfo *argv) - { - return JSTaggedValue::True(); - } - - void ContainersTreeSetForEachFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle dset = CreateJSAPITreeSet(thread); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestForEachFunc)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 8); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - objCallInfo->SetCallArg(0, func.GetTaggedValue()); - objCallInfo->SetCallArg(1, dset.GetTaggedValue()); - ContainersTreeSet::ForEach(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetForEachFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.h b/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.h deleted file mode 100644 index 9f4d8300fa..0000000000 --- a/test/fuzztest/containerstreesetforeach_fuzzer/containerstreesetforeach_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETFOREACH_FUZZER_H -#define CONTAINERSTREESETFOREACH_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetforeach_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/corpus/init b/test/fuzztest/containerstreesetforeach_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetforeach_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetforeach_fuzzer/project.xml b/test/fuzztest/containerstreesetforeach_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetforeach_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/BUILD.gn deleted file mode 100644 index 6e2eaa05af..0000000000 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/BUILD.gn +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetGetFirstValueFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetgetfirstvalue_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetgetfirstvalue_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetGetFirstValueFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp deleted file mode 100644 index 8dd3a1b78f..0000000000 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetgetfirstvalue_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetGetFirstValueFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::GetFirstValue(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetGetFirstValueFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.h b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.h deleted file mode 100644 index d8a166f019..0000000000 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/containerstreesetgetfirstvalue_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETGETFIRSTVALUE_FUZZER_H -#define CONTAINERSTREESETGETFIRSTVALUE_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetgetfirstvalue_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/corpus/init b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/project.xml b/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetgetfirstvalue_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/BUILD.gn deleted file mode 100644 index f9603c0203..0000000000 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/BUILD.gn +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetGetLastValueFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetgetlastvalue_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetgetlastvalue_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetGetLastValueFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp deleted file mode 100644 index 4db8284e6f..0000000000 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetgetlastvalue_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetGetLastValueFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::GetLastValue(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetGetLastValueFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.h b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.h deleted file mode 100644 index ca396ec6e1..0000000000 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/containerstreesetgetlastvalue_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETGETLASTVALUE_FUZZER_H -#define CONTAINERSTREESETGETLASTVALUE_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetgetlastvalue_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/corpus/init b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/project.xml b/test/fuzztest/containerstreesetgetlastvalue_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetgetlastvalue_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetgetlength_fuzzer/BUILD.gn deleted file mode 100644 index 260e23eb25..0000000000 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/BUILD.gn +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetGetLengthFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetgetlength_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetgetlength_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetGetLengthFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp b/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp deleted file mode 100644 index f568b0418c..0000000000 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetgetlength_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetGetLengthFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::GetLength(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetGetLengthFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.h b/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.h deleted file mode 100644 index 26d2970d54..0000000000 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/containerstreesetgetlength_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETGETLENGTH_FUZZER_H -#define CONTAINERSTREESETGETLENGTH_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetgetlength_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/corpus/init b/test/fuzztest/containerstreesetgetlength_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetgetlength_fuzzer/project.xml b/test/fuzztest/containerstreesetgetlength_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetgetlength_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetisempty_fuzzer/BUILD.gn deleted file mode 100644 index aef756ae31..0000000000 --- a/test/fuzztest/containerstreesetisempty_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetIsEmptyFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetisempty_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetisempty_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetIsEmptyFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp b/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp deleted file mode 100644 index 42f889b0b9..0000000000 --- a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetisempty_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetIsEmptyFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::IsEmpty(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetIsEmptyFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.h b/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.h deleted file mode 100644 index fbf2066d21..0000000000 --- a/test/fuzztest/containerstreesetisempty_fuzzer/containerstreesetisempty_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETISEMPTY_FUZZER_H -#define CONTAINERSTREESETISEMPTY_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetisempty_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/corpus/init b/test/fuzztest/containerstreesetisempty_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetisempty_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetisempty_fuzzer/project.xml b/test/fuzztest/containerstreesetisempty_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetisempty_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetpopfirst_fuzzer/BUILD.gn deleted file mode 100644 index c9572f6396..0000000000 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetPopFirstFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetpopfirst_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetpopfirst_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetPopFirstFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp b/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp deleted file mode 100644 index 3086badaaf..0000000000 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetpopfirst_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetPopFirstFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::PopFirst(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetPopFirstFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.h b/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.h deleted file mode 100644 index f714980448..0000000000 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/containerstreesetpopfirst_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETPOPFIRST_FUZZER_H -#define CONTAINERSTREESETPOPFIRST_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetpopfirst_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/corpus/init b/test/fuzztest/containerstreesetpopfirst_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpopfirst_fuzzer/project.xml b/test/fuzztest/containerstreesetpopfirst_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetpopfirst_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetpoplast_fuzzer/BUILD.gn deleted file mode 100644 index 0cae8f4234..0000000000 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetPopLastFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetpoplast_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetpoplast_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetPopLastFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp b/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp deleted file mode 100644 index 7a7179d1ac..0000000000 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetpoplast_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetPopLastFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::PopLast(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetPopLastFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.h b/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.h deleted file mode 100644 index ac483ce1ca..0000000000 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/containerstreesetpoplast_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETPOPLAST_FUZZER_H -#define CONTAINERSTREESETPOPLAST_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetpoplast_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/corpus/init b/test/fuzztest/containerstreesetpoplast_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetpoplast_fuzzer/project.xml b/test/fuzztest/containerstreesetpoplast_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetpoplast_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/BUILD.gn b/test/fuzztest/containerstreesetvalues_fuzzer/BUILD.gn deleted file mode 100644 index 608bf2b7a1..0000000000 --- a/test/fuzztest/containerstreesetvalues_fuzzer/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -#####################################hydra-fuzz############################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") -import("//build/test.gni") - -####################################fuzztest################################## -ohos_fuzztest("ContainersTreeSetValuesFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containerstreesetvalues_fuzzer" - - resource_config_file = - "//arkcompiler/ets_runtime/test/resource/js_runtime/ohos_test.xml" - - sources = [ "containerstreesetvalues_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersTreeSetValuesFuzzTest" ] -} diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp b/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp deleted file mode 100644 index f13e2d617d..0000000000 --- a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containerstreesetvalues_fuzzer.h" - -#include "ecmascript/containers/containers_private.h" -#include "ecmascript/containers/containers_treeset.h" -#include "ecmascript/ecma_string-inl.h" -#include "ecmascript/ecma_vm.h" -#include "ecmascript/global_env.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/napi/include/jsnapi.h" - -using namespace panda; -using namespace panda::ecmascript; -using namespace panda::ecmascript::containers; - -namespace OHOS { - - JSFunction *JSObjectCreate(JSThread *thread) - { - EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); - } - - EcmaRuntimeCallInfo *CreateEcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs) - { - auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle hclass(thread, JSObjectCreate(thread)); - JSHandle callee(factory->NewJSObjectByConstructor(JSHandle::Cast(hclass), hclass)); - JSHandle undefined = thread->GlobalConstants()->GetHandledUndefined(); - EcmaRuntimeCallInfo *objCallInfo = - EcmaInterpreter::NewRuntimeCallInfo(thread, undefined, callee, undefined, numArgs); - return objCallInfo; - } - - JSTaggedValue InitializeTreeSetConstructor(JSThread *thread) - { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - - JSHandle globalObject = env->GetJSGlobalObject(); - JSHandle key(factory->NewFromASCII("ArkPrivate")); - JSHandle value = - JSObject::GetProperty(thread, JSHandle(globalObject), key).GetValue(); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(value.GetTaggedValue()); - objCallInfo->SetCallArg(0, JSTaggedValue(static_cast(ContainerTag::TreeSet))); - JSTaggedValue result = ContainersPrivate::Load(objCallInfo); - return result; - } - - JSHandle CreateJSAPITreeSet(JSThread *thread) - { - JSHandle newTarget(thread, InitializeTreeSetConstructor(thread)); - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 6); - objCallInfo->SetFunction(newTarget.GetTaggedValue()); - objCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - objCallInfo->SetThis(JSTaggedValue::Undefined()); - - JSTaggedValue result = ContainersTreeSet::TreeSetConstructor(objCallInfo); - JSHandle set(thread, result); - return set; - } - - void ContainersTreeSetValuesFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - JSThread *thread = vm->GetJSThread(); - if (size <= 0) { - return; - } - int32_t key = 0; - size_t maxByteLen = 4; - if (size > maxByteLen) { - size = maxByteLen; - } - if (memcpy_s(&key, maxByteLen, data, size) != EOK) { - std::cout << "memcpy_s failed!"; - UNREACHABLE(); - } - - JSHandle tset = CreateJSAPITreeSet(thread); - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - callInfo->SetCallArg(0, JSTaggedValue(key)); - ContainersTreeSet::Add(callInfo); - - auto objCallInfo = CreateEcmaRuntimeCallInfo(thread, 4); - objCallInfo->SetFunction(JSTaggedValue::Undefined()); - objCallInfo->SetThis(tset.GetTaggedValue()); - ContainersTreeSet::Values(objCallInfo); - } - JSNApi::DestroyJSVM(vm); - } -} - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - OHOS::ContainersTreeSetValuesFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.h b/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.h deleted file mode 100644 index 86b4e3a58c..0000000000 --- a/test/fuzztest/containerstreesetvalues_fuzzer/containerstreesetvalues_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSTREESETVALUES_FUZZER_H -#define CONTAINERSTREESETVALUES_FUZZER_H - -#define FUZZ_PROJECT_NAME "containerstreesetvalues_fuzzer.h" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/corpus/init b/test/fuzztest/containerstreesetvalues_fuzzer/corpus/init deleted file mode 100644 index b9a20c8eb6..0000000000 --- a/test/fuzztest/containerstreesetvalues_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containerstreesetvalues_fuzzer/project.xml b/test/fuzztest/containerstreesetvalues_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containerstreesetvalues_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.h b/test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.h deleted file mode 100644 index 9c9d20ebbd..0000000000 --- a/test/fuzztest/containersvectorclear_fuzzer/containersvectorclear_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORCLEAR_FUZZER_H -#define CONTAINERSVECTORCLEAR_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorclear_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorclear_fuzzer/project.xml b/test/fuzztest/containersvectorclear_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorclear_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.h b/test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.h deleted file mode 100644 index f51425d9e4..0000000000 --- a/test/fuzztest/containersvectorclone_fuzzer/containersvectorclone_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORCLONE_FUZZER_H -#define CONTAINERSVECTORCLONE_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorclone_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorclone_fuzzer/project.xml b/test/fuzztest/containersvectorclone_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorclone_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h b/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h index 88a29b7d13..76b247d156 100644 --- a/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h +++ b/test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h @@ -28,6 +28,7 @@ #include "ecmascript/ecma_runtime_call_info.h" #include "ecmascript/js_thread.h" #include "ecmascript/object_factory.h" +#include "ecmascript/js_array.h" #define MAXBYTELEN sizeof(unsigned int) @@ -131,35 +132,6 @@ public: JSNApi::DestroyJSVM(vm); } - static void ContainersVectorGetFirstElementFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - JSHandle vector = CreateJSAPIVector(thread); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); // 6 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - std::string str(data, data + size); - JSTaggedValue value = factory->NewFromStdString(str).GetTaggedValue(); - callInfo->SetCallArg(0, value); - - ContainersVector::Add(callInfo); - - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - - ContainersVector::GetFirstElement(callInfo1); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorGetIndexOfFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; @@ -190,35 +162,6 @@ public: JSNApi::DestroyJSVM(vm); } - static void ContainersVectorGetLastElementFuzzTest(const uint8_t* data, size_t size) - { - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - JSHandle vector = CreateJSAPIVector(thread); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 6); // 6 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - std::string str(data, data + size); - JSTaggedValue value = factory->NewFromStdString(str).GetTaggedValue(); - callInfo->SetCallArg(0, value); - - ContainersVector::Add(callInfo); - - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - - ContainersVector::GetLastElement(callInfo1); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorHasFuzzTest(const uint8_t* data, size_t size) { RuntimeOption option; @@ -502,85 +445,6 @@ public: } }; - static void ContainersVectorReplaceAllElementsFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 6); // 6 : means the argv length - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle func = - factory->NewJSFunction(env, reinterpret_cast(TestClass::TestReplaceAllElementsFunc)); - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - callInfo1->SetCallArg(0, func.GetTaggedValue()); - ContainersVector::ReplaceAllElements(callInfo1); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorForEachFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - JSHandle vec = CreateJSAPIVector(thread); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 8); // 8 : means the argv length - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle func = - factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForEachFunc)); - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - callInfo1->SetCallArg(0, func.GetTaggedValue()); - callInfo1->SetCallArg(1, vec.GetTaggedValue()); - ContainersVector::ForEach(callInfo1); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorSortFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 6); // 6 : means the argv length - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - callInfo1->SetCallArg(0, JSTaggedValue::Undefined()); - ContainersVector::Sort(callInfo1); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorSubVectorFuzzTest(const uint8_t* data, size_t size) { if (size <= 0) { @@ -605,50 +469,6 @@ public: JSNApi::DestroyJSVM(vm); } - static void ContainersVectorClearFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::Clear(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorCloneFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::Clone(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorSetLengthFuzzTest(const uint8_t* data, size_t size) { if (size <= 0) { @@ -664,10 +484,10 @@ public: JSHandle vector = GetVectorWithData(thread, data, size); uint32_t length = 0; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; + if (size > MAXBYTELEN - 1) { + size = MAXBYTELEN - 1; } - if (memcpy_s(&length, MAXBYTELEN, data, size) != 0) { + if (memcpy_s(&length, MAXBYTELEN - 1, data, size) != 0) { std::cout << "memcpy_s failed!"; UNREACHABLE(); } @@ -681,72 +501,6 @@ public: JSNApi::DestroyJSVM(vm); } - static void ContainersVectorGetCapacityFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::GetCapacity(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorConvertToArrayFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::ConvertToArray(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorIsEmptyFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::IsEmpty(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorIncreaseCapacityToFuzzTest(const uint8_t* data, size_t size) { if (size <= 0) { @@ -762,10 +516,10 @@ public: JSHandle vector = GetVectorWithData(thread, data, size); uint32_t capacity = 0; - if (size > MAXBYTELEN) { - size = MAXBYTELEN; + if (size > MAXBYTELEN - 1) { + size = MAXBYTELEN - 1; } - if (memcpy_s(&capacity, MAXBYTELEN, data, size) != 0) { + if (memcpy_s(&capacity, MAXBYTELEN - 1, data, size) != 0) { std::cout << "memcpy_s failed!"; UNREACHABLE(); } @@ -779,50 +533,6 @@ public: JSNApi::DestroyJSVM(vm); } - static void ContainersVectorToStringFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::ToString(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - - static void ContainersVectorTrimToCurrentLengthFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - - JSHandle vector = GetVectorWithData(thread, data, size); - - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(vector.GetTaggedValue()); - ContainersVector::TrimToCurrentLength(callInfo); - } - JSNApi::DestroyJSVM(vm); - } - static void ContainersVectorCopyToArrayFuzzTest(const uint8_t* data, size_t size) { if (size <= 0) { @@ -851,35 +561,6 @@ public: } JSNApi::DestroyJSVM(vm); } - - static void ContainersVectorIteratorFuzzTest(const uint8_t* data, size_t size) - { - if (size <= 0) { - return; - } - RuntimeOption option; - option.SetLogLevel(common::LOG_LEVEL::ERROR); - EcmaVM *vm = JSNApi::CreateJSVM(option); - { - JsiFastNativeScope scope(vm); - auto thread = vm->GetAssociatedJSThread(); - JSHandle vector = GetVectorWithData(thread, data, size); - auto callInfo1 = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo1->SetFunction(JSTaggedValue::Undefined()); - callInfo1->SetThis(vector.GetTaggedValue()); - JSHandle iterValues(thread, ContainersVector::GetIteratorObj(callInfo1)); - - JSMutableHandle result(thread, JSTaggedValue::Undefined()); - constexpr int32_t ELEMENT_NUMS = 8; - for (uint32_t i = 0; i < ELEMENT_NUMS; i++) { - auto callInfo = CreateEcmaRuntimeCallInfo(thread, 4); // 4 : means the argv length - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(iterValues.GetTaggedValue()); - result.Update(JSAPIVectorIterator::Next(callInfo)); - } - } - JSNApi::DestroyJSVM(vm); - } }; } #endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorconverttoarray_fuzzer/BUILD.gn b/test/fuzztest/containersvectorconverttoarray_fuzzer/BUILD.gn deleted file mode 100644 index 0439a85e8c..0000000000 --- a/test/fuzztest/containersvectorconverttoarray_fuzzer/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorConvertToArrayFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectorconverttoarray_fuzzer" - - sources = [ "containersvectorconverttoarray_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorConvertToArrayFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorconverttoarray_fuzzer/project.xml b/test/fuzztest/containersvectorconverttoarray_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorconverttoarray_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorcopytoarray_fuzzer/BUILD.gn b/test/fuzztest/containersvectorcopytoarray_fuzzer/BUILD.gn index f5531f665b..b7022eabec 100644 --- a/test/fuzztest/containersvectorcopytoarray_fuzzer/BUILD.gn +++ b/test/fuzztest/containersvectorcopytoarray_fuzzer/BUILD.gn @@ -39,4 +39,4 @@ group("fuzztest") { testonly = true deps = [] deps += [ ":ContainersVectorCopyToArrayFuzzTest" ] -} +} \ No newline at end of file diff --git a/test/fuzztest/containersvectorcopytoarray_fuzzer/project.xml b/test/fuzztest/containersvectorcopytoarray_fuzzer/project.xml index 6e8ad2cfde..27c26d11b7 100644 --- a/test/fuzztest/containersvectorcopytoarray_fuzzer/project.xml +++ b/test/fuzztest/containersvectorcopytoarray_fuzzer/project.xml @@ -22,4 +22,4 @@ 4096 - + \ No newline at end of file diff --git a/test/fuzztest/containersvectorforeach_fuzzer/BUILD.gn b/test/fuzztest/containersvectorforeach_fuzzer/BUILD.gn deleted file mode 100644 index a74cc87806..0000000000 --- a/test/fuzztest/containersvectorforeach_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorForEachFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectorforeach_fuzzer" - - sources = [ "containersvectorforeach_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorForEachFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.h b/test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.h deleted file mode 100644 index 6435d8e4fa..0000000000 --- a/test/fuzztest/containersvectorforeach_fuzzer/containersvectorforeach_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORFOREACH_FUZZER_H -#define CONTAINERSVECTORFOREACH_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorforeach_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorforeach_fuzzer/corpus/init b/test/fuzztest/containersvectorforeach_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorforeach_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorforeach_fuzzer/project.xml b/test/fuzztest/containersvectorforeach_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorforeach_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.cpp b/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.cpp deleted file mode 100644 index cb6f6846b6..0000000000 --- a/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorgetcapacity_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorGetCapacityFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.h b/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.h deleted file mode 100644 index 9e2e37a419..0000000000 --- a/test/fuzztest/containersvectorgetcapacity_fuzzer/containersvectorgetcapacity_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORGETCAPACITY_FUZZER_H -#define CONTAINERSVECTORGETCAPACITY_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorgetcapacity_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetcapacity_fuzzer/corpus/init b/test/fuzztest/containersvectorgetcapacity_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorgetcapacity_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetcapacity_fuzzer/project.xml b/test/fuzztest/containersvectorgetcapacity_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorgetcapacity_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.cpp b/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.cpp deleted file mode 100644 index 61c09189c5..0000000000 --- a/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorgetfirstelement_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorGetFirstElementFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.h b/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.h deleted file mode 100644 index b902767575..0000000000 --- a/test/fuzztest/containersvectorgetfirstelement_fuzzer/containersvectorgetfirstelement_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORGETFIRSTELEMENT_FUZZER_H -#define CONTAINERSVECTORGETFIRSTELEMENT_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorgetfirstelement_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetfirstelement_fuzzer/corpus/init b/test/fuzztest/containersvectorgetfirstelement_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorgetfirstelement_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetfirstelement_fuzzer/project.xml b/test/fuzztest/containersvectorgetfirstelement_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorgetfirstelement_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorgetlastelement_fuzzer/BUILD.gn b/test/fuzztest/containersvectorgetlastelement_fuzzer/BUILD.gn deleted file mode 100644 index e97030f039..0000000000 --- a/test/fuzztest/containersvectorgetlastelement_fuzzer/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorGetLastElementFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectorgetlastelement_fuzzer" - - sources = [ "containersvectorgetlastelement_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorGetLastElementFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.cpp b/test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.cpp deleted file mode 100644 index fcec6cd372..0000000000 --- a/test/fuzztest/containersvectorgetlastelement_fuzzer/containersvectorgetlastelement_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorgetlastelement_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorGetLastElementFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetlastelement_fuzzer/corpus/init b/test/fuzztest/containersvectorgetlastelement_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorgetlastelement_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorgetlastelement_fuzzer/project.xml b/test/fuzztest/containersvectorgetlastelement_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorgetlastelement_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorisempty_fuzzer/BUILD.gn b/test/fuzztest/containersvectorisempty_fuzzer/BUILD.gn deleted file mode 100644 index bb353f1d23..0000000000 --- a/test/fuzztest/containersvectorisempty_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorIsEmptyFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectorisempty_fuzzer" - - sources = [ "containersvectorisempty_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorIsEmptyFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.cpp b/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.cpp deleted file mode 100644 index fb37e2a43f..0000000000 --- a/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorisempty_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorIsEmptyFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.h b/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.h deleted file mode 100644 index b38fdb63b7..0000000000 --- a/test/fuzztest/containersvectorisempty_fuzzer/containersvectorisempty_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORISEMPTY_FUZZER_H -#define CONTAINERSVECTORISEMPTY_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorisempty_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorisempty_fuzzer/corpus/init b/test/fuzztest/containersvectorisempty_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorisempty_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorisempty_fuzzer/project.xml b/test/fuzztest/containersvectorisempty_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorisempty_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectoriterator_fuzzer/BUILD.gn b/test/fuzztest/containersvectoriterator_fuzzer/BUILD.gn deleted file mode 100644 index a6e6d63303..0000000000 --- a/test/fuzztest/containersvectoriterator_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorIteratorFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectoriterator_fuzzer" - - sources = [ "containersvectoriterator_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorIteratorFuzzTest" ] -} diff --git a/test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.h b/test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.h deleted file mode 100644 index 1a6fd2cae9..0000000000 --- a/test/fuzztest/containersvectoriterator_fuzzer/containersvectoriterator_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORITERATOR_FUZZER_H -#define CONTAINERSVECTORITERATOR_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectoriterator_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectoriterator_fuzzer/corpus/init b/test/fuzztest/containersvectoriterator_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectoriterator_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectoriterator_fuzzer/project.xml b/test/fuzztest/containersvectoriterator_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectoriterator_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorreplaceallelements_fuzzer/BUILD.gn b/test/fuzztest/containersvectorreplaceallelements_fuzzer/BUILD.gn deleted file mode 100644 index 81a592034a..0000000000 --- a/test/fuzztest/containersvectorreplaceallelements_fuzzer/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorReplaceAllElementsFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectorreplaceallelements_fuzzer" - - sources = [ "containersvectorreplaceallelements_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorReplaceAllElementsFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.cpp b/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.cpp deleted file mode 100644 index 8043dfd6ce..0000000000 --- a/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorreplaceallelements_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorReplaceAllElementsFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.h b/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.h deleted file mode 100644 index 8123a5e878..0000000000 --- a/test/fuzztest/containersvectorreplaceallelements_fuzzer/containersvectorreplaceallelements_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORREPLACEALLELEMENTS_FUZZER_H -#define CONTAINERSVECTORREPLACEALLELEMENTS_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorreplaceallelements_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorreplaceallelements_fuzzer/corpus/init b/test/fuzztest/containersvectorreplaceallelements_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorreplaceallelements_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorreplaceallelements_fuzzer/project.xml b/test/fuzztest/containersvectorreplaceallelements_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorreplaceallelements_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectorsort_fuzzer/BUILD.gn b/test/fuzztest/containersvectorsort_fuzzer/BUILD.gn deleted file mode 100644 index 20d860be33..0000000000 --- a/test/fuzztest/containersvectorsort_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorSortFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectorsort_fuzzer" - - sources = [ "containersvectorsort_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorSortFuzzTest" ] -} diff --git a/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.cpp b/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.cpp deleted file mode 100644 index cea586b41f..0000000000 --- a/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectorsort_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorSortFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.h b/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.h deleted file mode 100644 index 2c72b70ab3..0000000000 --- a/test/fuzztest/containersvectorsort_fuzzer/containersvectorsort_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORSORT_FUZZER_H -#define CONTAINERSVECTORSORT_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectorsort_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectorsort_fuzzer/corpus/init b/test/fuzztest/containersvectorsort_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectorsort_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectorsort_fuzzer/project.xml b/test/fuzztest/containersvectorsort_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectorsort_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectortostring_fuzzer/BUILD.gn b/test/fuzztest/containersvectortostring_fuzzer/BUILD.gn deleted file mode 100644 index a60dfa45ae..0000000000 --- a/test/fuzztest/containersvectortostring_fuzzer/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorToStringFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = - "//arkcompiler/ets_runtime/test/fuzztest/containersvectortostring_fuzzer" - - sources = [ "containersvectortostring_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorToStringFuzzTest" ] -} diff --git a/test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.h b/test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.h deleted file mode 100644 index 53ea4948b3..0000000000 --- a/test/fuzztest/containersvectortostring_fuzzer/containersvectortostring_fuzzer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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. - */ - -#ifndef CONTAINERSVECTORTOSTRING_FUZZER_H -#define CONTAINERSVECTORTOSTRING_FUZZER_H - -#define FUZZ_PROJECT_NAME "containersvectortostring_fuzzer" - -#endif \ No newline at end of file diff --git a/test/fuzztest/containersvectortostring_fuzzer/corpus/init b/test/fuzztest/containersvectortostring_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectortostring_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectortostring_fuzzer/project.xml b/test/fuzztest/containersvectortostring_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectortostring_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/BUILD.gn b/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/BUILD.gn deleted file mode 100644 index b6b7bbb48d..0000000000 --- a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -##################################hydra-fuzz################################### -import("//arkcompiler/ets_runtime/js_runtime_config.gni") -import("//arkcompiler/ets_runtime/test/test_helper.gni") -import("//build/config/features.gni") -import("//build/ohos.gni") - -##################################fuzztest##################################### -ohos_fuzztest("ContainersVectorTrimToCurrentLengthFuzzTest") { - module_out_path = ets_runtime_output_path - - fuzz_config_file = "//arkcompiler/ets_runtime/test/fuzztest/containersvectortrimtocurrentlength_fuzzer" - - sources = [ "containersvectortrimtocurrentlength_fuzzer.cpp" ] - - configs = [ "//arkcompiler/ets_runtime:ecma_test_config" ] - - deps = [ "../../../:libark_jsruntime_test" ] - - # hiviewdfx libraries - external_deps = hiviewdfx_ext_deps - external_deps += [ sdk_libc_secshared_dep ] - deps += hiviewdfx_deps -} - -group("fuzztest") { - testonly = true - deps = [] - deps += [ ":ContainersVectorTrimToCurrentLengthFuzzTest" ] -} diff --git a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.cpp b/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.cpp deleted file mode 100644 index 8f60eb9444..0000000000 --- a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/containersvectortrimtocurrentlength_fuzzer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * 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 "containersvectortrimtocurrentlength_fuzzer.h" -#include "test/fuzztest/containersvectorcommon_fuzzer/containersvectorcommon_fuzzer.h" - -using namespace panda::ecmascript; - -// Fuzzer entry point. -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) -{ - // Run your code on data. - ContainersVectorFuzzTestHelper::ContainersVectorTrimToCurrentLengthFuzzTest(data, size); - return 0; -} \ No newline at end of file diff --git a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/corpus/init b/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/corpus/init deleted file mode 100644 index d175fac243..0000000000 --- a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/corpus/init +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# 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. - -FUZZ \ No newline at end of file diff --git a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/project.xml b/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/project.xml deleted file mode 100644 index 6e8ad2cfde..0000000000 --- a/test/fuzztest/containersvectortrimtocurrentlength_fuzzer/project.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - 1000 - - 300 - - 4096 - - diff --git a/test/resource/js_runtime/ohos_test.xml b/test/resource/js_runtime/ohos_test.xml index cf54f11175..a76200a2b7 100755 --- a/test/resource/js_runtime/ohos_test.xml +++ b/test/resource/js_runtime/ohos_test.xml @@ -1810,7 +1810,52 @@