History log of /openbmc/openbmc-build-scripts/scripts/unit-test.py (Results 26 – 50 of 181)
Revision Date Author Comments
# 9d43ecfe 24-May-2023 Andrew Jeffery <andrew@aj.id.au>

unit-test: Increase available debug information for test builds

Configuring `-Og` helps ensure `abi-dumper` has all the information it
would like for ABI analysis.

```
...
[18/39] Generatin

unit-test: Increase available debug information for test builds

Configuring `-Og` helps ensure `abi-dumper` has all the information it
would like for ABI analysis.

```
...
[18/39] Generating abi-dump with a custom command
Detect public symbols
Reading debug-info
WARNING: incompatible build option detected: -O0 (required -Og for better analysis)
...
```

Change-Id: Ia4d2add17a1e65bb480cb7003597af62c8e47bc2
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 71924fdb 12-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

unit-test: Make UBSAN kill tests

Continuing to exploit the runtime library means we get useful
diagnostics printed rather than just the application generating a core.

Change-Id: I0b93e61bbca48eb5a7

unit-test: Make UBSAN kill tests

Continuing to exploit the runtime library means we get useful
diagnostics printed rather than just the application generating a core.

Change-Id: I0b93e61bbca48eb5a79ba6fa9228431d36504f64
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# cebaea28 12-Apr-2023 Patrick Williams <patrick@stwcx.xyz>

unit-test: add meson version check for get_variable

Some repositories are using the newer `get_variable` call in meson
without a keyword argument. This requires meson 0.58 or later. I've
contribut

unit-test: add meson version check for get_variable

Some repositories are using the newer `get_variable` call in meson
without a keyword argument. This requires meson 0.58 or later. I've
contributed fixes for all repositories under the
`meson_deprecated_pkgconfig` topic and so am also adding a CI catch
to prevent future regressions.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9465c3946825ec96d0c934635685e85d74fdf4ee

show more ...


# 688f837a 02-Mar-2023 Brad Bishop <bradleyb@fuzziesquirrel.com>

cppcheck: enable inline-suppr

Allow inline suppression of cppcheck errors for special cases. Some
example use cases might be:

- suppress accessMoved in a unit test for a move constructor (ensuring

cppcheck: enable inline-suppr

Allow inline suppression of cppcheck errors for special cases. Some
example use cases might be:

- suppress accessMoved in a unit test for a move constructor (ensuring
the moved from object is in the expected state).
- suppress noExplicitConstructor for RAII types where implicit
conversion is intentional and desired.

Change-Id: I560d780fdf9266dc54662a9eeb6ed6986fc271a8
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...


# 1eb1994b 10-Feb-2023 Ed Tanous <edtanous@google.com>

Run clang-tidy in meson

Meson has built in functionality for running clang-tidy. It improves on
run-clang-tidy because it will also run each header file individually,
rather than relying on their #

Run clang-tidy in meson

Meson has built in functionality for running clang-tidy. It improves on
run-clang-tidy because it will also run each header file individually,
rather than relying on their #inclusion into a src file, which can find
far more missing #includes, and seems to find more issues in complex
source files (unclear why).

Tested: I've walked through all the repos that have a .clang-tidy, and
I've systematically fixed the issues, so hopefully this change has no
impact. I have yet to see this cause any functional impact.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I62520056192d876938ddab4d7cdafc954fa1806d

show more ...


# 87ab5705 13-Jan-2023 Michael Shen <gpgpgp@google.com>

unit-test: support install process in cmake

This change allows cmake-based project to install the
executable/library/configuration to the right directory.

Tested:
Manually run the commands below in

unit-test: support install process in cmake

This change allows cmake-based project to install the
executable/library/configuration to the right directory.

Tested:
Manually run the commands below in the docker.
```
$ sudo cmake --install .
-- Install configuration: ""
-- Installing: /usr/local/lib/xxx.so
-- Installing: /usr/local/include/xxx.h
-- Installing: /usr/local/bin/xxx_tool
```

Change-Id: Ica9f0c26c57baca5d46067c1bb55ecccc2d8fc58
Signed-off-by: Michael Shen <gpgpgp@google.com>

show more ...


# 29e02313 19-Dec-2022 Ed Tanous <edtanous@google.com>

Make clang-tidy projects compile on clang

Compiling individual repos on clang gives us an extra set of checks, and
ensures that we are coding to the c++ standard, and not to gcc
specifics. In pract

Make clang-tidy projects compile on clang

Compiling individual repos on clang gives us an extra set of checks, and
ensures that we are coding to the c++ standard, and not to gcc
specifics. In practice, a lot of the repos have compiled against clang
for a while, but leads to maintainers jumping in from time to time to
fix the clang build with seemingly minor changes that are better caught
at review time.

This commit causes the clang build (created as part of the tidy checks)
to actually compile, which can find issues like
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/51346 that clang
finds, but gcc does not (or allows silently).

I walked through every repo I'm aware of that are relying on clang-tidy,
and made sure that they compile with clang. bmcweb, dbus-sensors, and
entity-manager have patchsets in review to resolve the minor issues,
that should be merged before this.

sdeventplus builds with clang as-is.

Tested:
Compiled repos above against clang with the aforementioned commits, and
build passed.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I310f9aebc75fe4bc9645c4c961ca0caf8f94b4d5

show more ...


# e795dfe4 06-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: enable black/isort

* black is a widely used python formatting tool.
* isort is used to order python imports in a consistent way.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

format-code: enable black/isort

* black is a widely used python formatting tool.
* isort is used to order python imports in a consistent way.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1918421120ce2942f04b9110a2c0f1bd820d21c7

show more ...


# e08ffba8 05-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

python: fix flake8 warnings and format with black

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic54f4a3ecf328b0d2c65af5cfd9eb2048d671ad5


# 330b0777 28-Nov-2022 Patrick Williams <patrick@stwcx.xyz>

unit-test: always call global formatter

There has been some confusion about the relationship between the global
and local formatters (the one here vs the one in repositories). The
previous behavior

unit-test: always call global formatter

There has been some confusion about the relationship between the global
and local formatters (the one here vs the one in repositories). The
previous behavior was that if the local formatter existed then the
global formatter was ignored. In most cases this leads to duplicative
or missing functionality.

The global formatter already has some code in place for calling local
formatters as secondary formatters. Leverage this and ensure the
global formatter is always called.

Running the following resulted in no repositories with local formatters
failing:
```
find -maxdepth 2 -name "format-code.sh" | xargs -n1 dirname | \
xargs -n1 openbmc-build-scripts/scripts/format-code.sh
openbmc-build-scripts/scripts/format-code.sh entity-manager
```

I also manually inspected all of the format-code scripts and they all
seem safe to utilize the global formatter as well.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I88f3266062528e7fcf6ea71515c02d2d40048ae2

show more ...


# c1513c88 27-Nov-2022 Patrick Williams <patrick@stwcx.xyz>

format-code: improve script ergonomics

- Add getopt and help-text.
- Default to `pwd` for repository.
- Utilize `git rev-parse` to find repo-root if ran from subdir.
- Find default config di

format-code: improve script ergonomics

- Add getopt and help-text.
- Default to `pwd` for repository.
- Utilize `git rev-parse` to find repo-root if ran from subdir.
- Find default config directory using `${BASH_SOURCE[0]}`.
- Improve and colorize logging.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I925b17f65fe817d30a0932954761d3849e27a8ea

show more ...


# 82aaba03 15-Sep-2022 Nan Zhou <nanzhoumails@gmail.com>

clang-tidy: use TemporaryDirectory

This patch changes clang-tidy build of cmake and meson to use
TemporaryDirectory. So that no need to explicitly delete the build
directory. There is no need to har

clang-tidy: use TemporaryDirectory

This patch changes clang-tidy build of cmake and meson to use
TemporaryDirectory. So that no need to explicitly delete the build
directory. There is no need to hardcode the name as well. I kept the
prefix of the temp folder to be "build". This is to make gitignore of
most repos still work.

Tested:
1. used phosphor-user-manager as a typical meson repo. Tested
with/without clang-tidy. Both worked
2. used peci-pcie as a typical CMakeList repo. Tested with/without
clang-tidy. Both worked (but the repo itself doesn't pass clang build
bacause of its own reason)

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ic355e390db7349ded73ad3d17a03a40b83460249

show more ...


# 524ebee8 27-Aug-2022 Nan Zhou <nanzhoumails@gmail.com>

clang-tidy: try to remove old directories

Just like the existing meson build codes, this patch tries to delete old
clang-tidy build directories before making a new one.

Tested:
Tested both cmake an

clang-tidy: try to remove old directories

Just like the existing meson build codes, this patch tries to delete old
clang-tidy build directories before making a new one.

Tested:
Tested both cmake and meson repos, old directories are deleted as
expected before making a new one.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I36a484d5832a1f427ef0e1b9b1f28183ccdc387e

show more ...


# 485a0923 12-Aug-2022 Patrick Williams <patrick@stwcx.xyz>

unit-test: cppcheck: use temporary directory

The previous code would create a directory named `cppcheck-temp`
in the root of the repository under test as the cppcheck cache but
never cleaned it up.

unit-test: cppcheck: use temporary directory

The previous code would create a directory named `cppcheck-temp`
in the root of the repository under test as the cppcheck cache but
never cleaned it up. This left stray directories around when using
the unit test locally.

Switch the mechanism to use tempfile.TemporaryDirectory so that
the directory is automatically cleaned up when the testing is
complete.

Tested: Ran unit-test locally and observed cppcheck-temp directory
no longer remains[1].

1. https://github.com/williamspatrick/dotfiles/blob/840250f0c56b299a8de47cc2ea7c558a14eeb517/env/30_linux/lfopenbmc.zsh#L76

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Idde8feb28bef663d156c5d1d1f21a3d8c629c72d

show more ...


# dbd7cd62 19-Jul-2022 Lei YU <yulei.sh@bytedance.com>

scripts/unit-test.py: Fix an indent issue

The indent is incorrect and is fixed by autopep8

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I2d91c2bd3c32e2fc495eca137406fe234726a105


# c7198558 01-Jul-2022 Ed Tanous <edtanous@google.com>

Improve cppcheck results and calling code

In the ideal case, cppcheck would have an option where it could be
enforcing in the future. This commit works toward that goal, but
doesn't quite get there

Improve cppcheck results and calling code

In the ideal case, cppcheck would have an option where it could be
enforcing in the future. This commit works toward that goal, but
doesn't quite get there.

First, it updates cppcheck to the latest copy from github, instead of
pulling through apt sources. This is done because the current cppcheck
has an issue with std::string_view, and erroneously believes that it
should be passed by reference. The master branch has a fix for this.

Next, it modifies the call of cppcheck in a couple ways, first, to rely
on compile_commands.json from the build step, rather than attempting to
build a list of files itself. This is less error prone, and allows
"whole binary" scans with cppcheck, which leads to fewer false
positives. On the negative side, this means that non-meson/non-cmake
projects will no longer get scanned, which, considering that meson is
what we're converging on, and for any given project a meson port should
probably take priority over cppcheck improvements, this seems
reasonable.

Because of the previous change, the use of popen and communicate() can
be replaced with our more normal methods for calling commands, which
cleans up the code quite a bit.

Adds a cppcheck-temp folder as recommended by the cppcheck docs for
storing intermediate results. This decreases the amount of time
cppcheck takes to run when scanning the same code multiple times.

After that, some argument changes are done to suppress checks that are
noisy, and the project doesn't currently have a way to make pass.

useStlAlgorithm this is just a suggestion, and not always correct, so
it's difficult to make it enforcing. Also, as a project, we tend to not
optimize for std::algorithms as much as we could. At some point in the
future we could turn this back on and make the project have a stronger
opinion on this style, but for the moment, this seems like something to
tackle later.
unusedStructMember this appears to either have bugs, or not understand
when a public struct member is used outside of the compile unit. It
leads to significant noise for things that are actually used, but get
marked unused because they're not used in every compile unit.
postfixOperator use of prefix increment indead of postfix on iterators
is not generally something we enforce on the project, and doesn't seem
like it improves in either the readability or the code, as well as leads
to a lot of noise. Disable for the moment.
unreadVariable Similar to unusedStructMember, this check seems to not be
able to see all possible ifdefs in a section of code, and leads to many
false positives.
knownConditionTrueFalse is supressed because apparently cppcheck isn't
able to read macros, so this flags significant portions of code behind
ifdefs. More investigation is warranted here, but for the moment,
disabling the check gets us closer to the goal

A patch series getting bmcweb code to the point where it's 100% passing
is here, if you want to see the types of changes that cppcheck proposes.
For all the non-disabled checks, cppcheck seems accurate, with no false
positives that I could find, although some slightly pedantic
suggestions.

https://gerrit.openbmc.org/c/openbmc/bmcweb/+/55001

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7730cc69ad1817cb7d75c04be3b7d1da6c1030d4

show more ...


# 37052418 20-May-2022 Andrew Geissler <geissonator@yahoo.com>

move all build scripts to gerrit.openbmc.org

OpenBMC has transitioned the gerrit server to the openbmc.org domain

Change-Id: Ia65d5f968a4ffcf3bc65536148e90e42725c86aa
Signed-off-by: Andrew Geissler

move all build scripts to gerrit.openbmc.org

OpenBMC has transitioned the gerrit server to the openbmc.org domain

Change-Id: Ia65d5f968a4ffcf3bc65536148e90e42725c86aa
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>

show more ...


# 08d2b929 24-Apr-2022 Lei YU <yulei.sh@bytedance.com>

unit-test.py: Format with autopep8

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If2af9b695ec6325aebf7fafb9f5ef17e43a52c40


# d9062c48 05-May-2022 William A. Kennington III <wak@google.com>

scripts/unit-test: Leverage meson log output

Instead of trying to find the logs ourselves, just leverage meson to
print the logs directly.

Change-Id: Iab8b54936efb6c5230e538a06e045f9f23733017
Signe

scripts/unit-test: Leverage meson log output

Instead of trying to find the logs ourselves, just leverage meson to
print the logs directly.

Change-Id: Iab8b54936efb6c5230e538a06e045f9f23733017
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...


# 88db4c20 25-Jan-2022 Ed Tanous <edtanous@google.com>

Make clang-tidy propose diffs

clang-tidy supports a -fix option, which will directly apply the diffs
that it's able to do automatically to the tree. This is advantageous
for developers, because it

Make clang-tidy propose diffs

clang-tidy supports a -fix option, which will directly apply the diffs
that it's able to do automatically to the tree. This is advantageous
for developers, because it gives them a quick way to "do as the robot
commands" when run locally, and makes it more obvious in the output
exactly what's being asked for in a changeset.

Unfortunately, to use this feature, the run-clang-tidy script needs to
be run from the build folder directly, which involves a cd into the
directory. We actually already had to do this for cmake elsewhere in
this file, but it didn't get propagated to meson builds.

At the same time, when run-clang-tidy fails to run, catch the error and
run the same "git diff" procedure that we run elsewhere such that the
diff is printed to the console.

Tested:
Updated clang-tidy to include a new check for
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50660

and ran run-unit-test-docker.sh, and observed that both the bmcweb tree
had been updated locally, and the diff was printed to the console
output.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I04ef8c136c8e72e7787cebe018cfe2289d7f2c59

show more ...


# 32768b87 05-Jan-2022 Ed Tanous <edtanous@google.com>

Check the result of formatting the code

The old format-code.sh script used to run git diff to determine if any
files had been reformatted in the commit. The "new" way should do the
same.

Tested:
R

Check the result of formatting the code

The old format-code.sh script used to run git diff to determine if any
files had been reformatted in the commit. The "new" way should do the
same.

Tested:
Ran a build on entity-manager, which includes a custom format-code
script, and saw the build pass. Backed up to the commit prior, which
included formatting violations, reran and saw the build fail.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3697da5dbbe78bb2241bb66d2583b2c9c2f9e753

show more ...


# f89c8508 01-Oct-2021 Patrick Williams <patrick@stwcx.xyz>

clang: update to clang-13

clang-13 is now released:
https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.0

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Signed-off-by: Ed Tanous

clang: update to clang-13

clang-13 is now released:
https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.0

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia6171c192031e7522030c6c3053a322c55c65d52

show more ...


# 01534ec4 14-Oct-2021 Willy Tu <wltu@google.com>

unit-test: Add google-misc/libcr51sign to run as dependencies in runtime

https://github.com/openbmc/google-misc

Signed-off-by: Willy Tu <wltu@google.com>
Change-Id: I1f75a3cfb18f110484ba8ec32bc1be0

unit-test: Add google-misc/libcr51sign to run as dependencies in runtime

https://github.com/openbmc/google-misc

Signed-off-by: Willy Tu <wltu@google.com>
Change-Id: I1f75a3cfb18f110484ba8ec32bc1be0237a94915

show more ...


# eb667265 06-Aug-2021 Brad Bishop <bradleyb@fuzziesquirrel.com>

unit-test: don't find files in meson subprojects

Support running against source trees with populated meson subprojects.

Avoid running ci scripts and code formatters from subprojects since they
are

unit-test: don't find files in meson subprojects

Support running against source trees with populated meson subprojects.

Avoid running ci scripts and code formatters from subprojects since they
are not the repository under test.

Change-Id: I753915926b06fdebfbe77c3157432ff07077b742
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...


# 3992d10c 17-May-2021 William A. Kennington III <wak@google.com>

scripts/build-unit-test-docker: Update to meson 0.58.0

Change-Id: Id8e90ffa6d2bf94c4c821a5d79bde7a9e04d26c3
Signed-off-by: William A. Kennington III <wak@google.com>


12345678