From 61f1ca1b31a9a1108e9e7f71e47fdc19beb0490b Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Wed, 3 Nov 2021 14:40:53 -0700 Subject: Update to internal 0.77 Signed-off-by: Jason M. Bills --- .../recipes-utilities/oom-test/files/.clang-format | 99 ++++++++++++++++++++++ .../recipes-utilities/oom-test/files/meson.build | 21 +++++ .../recipes-utilities/oom-test/files/oom-test.c | 86 +++++++++++++++++++ .../recipes-utilities/oom-test/oom-test.bb | 14 +++ 4 files changed, 220 insertions(+) create mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/.clang-format create mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/meson.build create mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/oom-test.c create mode 100644 meta-openbmc-mods/meta-common/recipes-utilities/oom-test/oom-test.bb (limited to 'meta-openbmc-mods/meta-common/recipes-utilities/oom-test') diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/.clang-format b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/.clang-format new file mode 100644 index 000000000..ea71ad6e1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/.clang-format @@ -0,0 +1,99 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +PointerAlignment: Left +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^[<"](gtest|gmock)' + Priority: 5 + - Regex: '^"config.h"' + Priority: -1 + - Regex: '^".*\.hpp"' + Priority: 1 + - Regex: '^<.*\.h>' + Priority: 2 + - Regex: '^<.*' + Priority: 3 + - Regex: '.*' + Priority: 4 +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Never +... + diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/meson.build b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/meson.build new file mode 100644 index 000000000..215a7e60b --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/meson.build @@ -0,0 +1,21 @@ +project( + 'oom-test', + 'c', + default_options: [ + 'warning_level=3', + 'werror=true', + 'c_std=c11' + ], + license: 'Apache-2.0', + version: '0.1', +) +project_description = 'OOM (Out Of Memory) Test Application' + +executable( + 'oom-test', + [ + 'oom-test.c', + ], + install: true, + install_dir: get_option('bindir') +) diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/oom-test.c b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/oom-test.c new file mode 100644 index 000000000..90363a4b2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/files/oom-test.c @@ -0,0 +1,86 @@ +/* +// Copyright (c) 2021 Intel Corporation +// +// 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. +// +// Abstract: oom test application +// +*/ + +#include +#include +#include + +void Usage(char* progname) +{ + printf("Usage:\n"); + printf("%s -s \n", progname); + printf("Options:\n"); + printf("\t%-12s%s\n", "-h", "Display this help information"); + printf("\t%-12s%s\n", "-s ", + "Allocation unit size for getting heap in infinite loop"); + printf("\n"); +} + +int main(int argc, char** argv) +{ + int c, i, unitSize = 0, allocSize = 0; + + while (-1 != (c = getopt(argc, argv, "h:s:"))) + { + switch (c) + { + case 'h': + Usage(argv[0]); + return 0; + + case 's': + if (optarg != NULL) + { + unitSize = (int)strtoul(optarg, NULL, 0); + } + break; + + default: + Usage(argv[0]); + return 1; + } + } + + if (!unitSize) + { + printf("Error: Invalid allocation unit size\n"); + Usage(argv[0]); + return 1; + } + + while (1) + { + char* buf = (char*)malloc(unitSize); + if (!buf) + { + printf("Can't allocate memory!\n"); + exit(0); + } + + printf("Filling allocated memory...\n"); + for (i = 0; i < unitSize; i++) + buf[i] = 1; + + printf("Allocated %d MB\n", (++allocSize * 10)); + + /* continue looping without freeing to make OOM condition */ + } + + return 0; +} diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/oom-test.bb b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/oom-test.bb new file mode 100644 index 000000000..eb943af8d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-utilities/oom-test/oom-test.bb @@ -0,0 +1,14 @@ +SUMMARY = "OOM Test App" +DESCRIPTION = "OOM (Out Of Memory) Test Application" + +inherit meson + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM += "\ + file://oom-test.c;beginline=2;endline=14;md5=5175224c8877845cb45a6461c96de64d \ + " + +SRC_URI = "\ + file://meson.build;subdir=${BP} \ + file://oom-test.c;subdir=${BP} \ + " -- cgit v1.2.3