Commit Graph

20 Commits

Author SHA1 Message Date
Nicolas Benech
44574a01bb gpu: nvgpu: unit: Add mockio unit test to tmake
MockIO unit test went in before the tmake changes. Now
adding tmake files so that it builds for target.

Change-Id: I9f08076a46f8f6487342553999d43279fb74cabb
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1851219
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-28 23:55:13 -07:00
Alex Waterman
3bbd40366a gpu: nvgpu: unit: Add posix-env test to unit tests
Add the posix-env test to the unit test suite that gets built
by tmake. This test caught a legit bug in the posix impl on
the target platform which needed to be fixed first.

JIRA NVGPU-1234

Change-Id: Ic62eac0bb62741dd03883dcd24c57b49ff67fa0e
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1846180
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-27 15:07:13 -07:00
Nicolas Benech
c6eae929fd gpu: nvgpu: posix: Multithreading for unit tests
Add a -j argument to enable running unit tests on several
threads. Also adds signal handling to prevent a fatal
error in one thread from killing the whole unit test
framework.

JIRA NVGPU-1043

Change-Id: I891a547640cd005a50ffa5c06367ed46c54de012
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1847740
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-27 14:04:17 -07:00
Philip Elcan
bf99dfdaf2 gpu: nvgpu: unit: update unit.h for target
The directory structure is every so slightly different on target, so
this handles the differences.

JIRA NVGPU-1042

Change-Id: I5a0566c7d371fcb5cd541c71841e8acedfaac6e2
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1837443
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-24 15:54:55 -07:00
Philip Elcan
b3127c45fb gpu: nvgpu: unit: build posix-bitops in tmake
This builds the posix-bitops unit test shared library in the tmake build
system for target.  The systemimage output is in
nvgpu_unit/build/units/libunit-posix-bitops.so

JIRA NVGPU-1042

Change-Id: Id73a1f3e7d8de4e21e3a7f5c5bd036e0ce62ad3e
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1822288
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-24 15:54:18 -07:00
Philip Elcan
9ac1e34312 gpu: nvgpu: unit: build in tmake
This builds the nvgpu userspace in the tmake build system. The shared
library and the unit test binary are built for target. The output goes
to the systemimage in nvgpu_unit/build.

JIRA NVGPU-1042

Change-Id: I70a118bc02789caf838b2b8e9d6778e94239c56f
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1822287
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-24 15:54:13 -07:00
Nicolas Benech
5c7a740403 gpu: nvgpu: unit: Add mockio unit test
Add a unit test to make sure the posix IO mocking works
corretly.

JIRA NVGPU-1040

Change-Id: Iadec2f515c9dd74dc0723885b3a6560dc91ce052
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1741954
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-24 15:52:34 -07:00
Alex Waterman
ec067c5ed1 gpu: nvgpu: Add POSIX sanity unit test
Add a unit test to do sanity checks for the environment. These
checks currently include:

  - Size of types (f.e. u32 is really 4 bytes)
  - Signedness of types (u32 is really unsigned)
  - Endianness check
  - Pointers fit in u64s

Note: the endianness check does not fail for either detected
endianness. It just prints the determined endianness. The exception
to this is if the check itself is broken and does not successfully
determine what endianness the underlying machine is. In that case
the test fails. Unless the underlying architure is a so called
middle endian machine something is horribly wrong.

We will determine what to actually do about this endianness
check once we determine what we need to do with BIOS fields,
etc. We proabbly don't really care what the machine endianness is
but we do need to make sure that we access data that may not match
machine endianness correctly.

JIRA NVGPU-1039

Change-Id: I5be68cf4dcea87e9e746262fcc0372380ef57df4
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1816897
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-20 15:14:51 -07:00
Philip Elcan
fa7394037c gpu: nvgpu: unit: posix_bitops: fix fls() tests
The fls() test assumed fls(1)=0, but really fls(1)=1, etc.

Bug found as result of JIRA NVGPU-1042.

Change-Id: I8d0ffe53277f4923a970b46788165ef03b385703
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1828362
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-20 12:58:54 -07:00
Konsta Holtta
1982d050cc gpu: nvgpu: unit: deref twice in qsort callback
The compare function for qsort takes pointers to compared elements, and
our elements are already pointers so the void pointer has to be cast to
a pointer pointer. Dereferencing only once would compare some data
that's in the array of module pointers (or past it), not the actual data
where the module pointers point to.

Change-Id: I65678863eddd6fc86d4ffceb621f8123944b058d
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1828164
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-17 23:42:05 -07:00
Konsta Holtta
cf394f82d4 gpu: nvgpu: include correct header in bitops test
The right one is nvgpu/bitops.h, not nvgpu/posix/bitops.h even though
this is a test for the posix layer. The latter is not meant to be
included directly and does not contain everything necessary.

Change-Id: I86a580abc6202064a3fbaa445bb1618b91e5ac4c
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812230
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-09-04 09:44:27 -07:00
Anup Mahindre
02f9c99e4b userspace: Enable nvgpu-next build
Added targets in corresponding makefiles/sources to enable building
nvgpu-next from userspace.

JIRA NVGPU-1015

Change-Id: Ia358162e14205035e4552bfb7f32825c7de48fc2
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1792003
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-14 12:10:31 -07:00
Terje Bergstrom
c989f31593 gpu: nvgpu: Make userspace build stricter
Add a bunch of build warning flags to make userspace builds mimic
the strictness of standard tmake builds.

Change-Id: If6f1f716f2bb2d64d240a66be2cb3aae814f24d0
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1796239
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-10 21:33:30 -07:00
Terje Bergstrom
6af7b2288f gpu: nvgpu: module.c should #include its own hdr
userspace/src/module.c should #include its own <unit/module.h> to get
declarations for the functions defined.

Change-Id: Icff647f19468607ebfb757360b83ce9f133bd5ec
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1797034
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-10 21:33:27 -07:00
Alex Waterman
542e6a0ab4 gpu: nvgpu: unit: Add a posix-bitmap impl unit test
Add a unit test to test the nvgpu-posix bitmap implementation. This
unit test aims to both verify the functionality of this low level
set of APIs and provide a reference for how to use the basic unit
test functionality.

JIRA NVGPU-525

Change-Id: Ide5263e5ce49f18f5f2a3d4a6f9e494395299386
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1695007
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-09 23:11:17 -07:00
Alex Waterman
98d092e736 gpu: nvgpu: unit: Add test unit module
Add a super simple tiny test unit module to test the unit test
framework.

This unit test has a test that deliberately fails so it obviously
cannot be part of a real unit test run. Eventually this will have
to be removed or otherwise skipped.

JIRA NVGPU-525

Change-Id: I41532a85156445a778897bbc84bb5919deab56ae
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1687095
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-09 23:11:13 -07:00
Alex Waterman
70915d8d60 gpu: nvgpu: unit: Sort unit tests by priority
Sort unit tests by their priority before running said unit tests.
There are three available priorities:

  UNIT_PRIO_SELF_TEST
  UNIT_PRIO_POSIX_TEST
  UNIT_PRIO_NVGPU_TEST

Which correspond to the types of testing expected to be run. In
general unit tests should always just use UNIT_PRIO_NVGPU_TEST but
in the case of tests for the POSIX API layer or the unit test
framework the other two priorities are provided.

The reason for this is that it doesn't make much sense to run a
bunch of unit tests if the environment itself or the POSIX API
layer is broken. By placing these tests at the front of the list
of tests to run an engineer will easily be able to see if there
are core problems versus nvgpu problems.

This also lets users fine grain control of test order by adding
or subtracting to UNIT_PRIO_NVGPU_TEST but one must be very
careful about how they do this.

JIRA NVGPU-525

Change-Id: I12a5b798e998f34e4d1168bb3696c579460f20b1
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1741953
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-09 23:11:09 -07:00
Alex Waterman
691bf90445 gpu: nvgpu: unit: Add unit testing FW
Full documentation for this is in the unit testing
confluence page.

JIRA NVGPU-525
Bug 2261555

Change-Id: I463e6267eb0eb12b7313f8b275266e8faabe5ccf
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1683915
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-08-09 23:11:06 -07:00
Alex Waterman
9222ddfae1 gpu: nvgpu: Delete README for POSIX code
This was not useful: documentation is in confluence.

Change-Id: I6028d751ca518e7105fea4e30bb0b20f40a701a6
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1710838
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-05-11 14:10:29 -07:00
Alex Waterman
6e739d924f gpu: nvgpu: Userspace POSIX support
Add support for compiling nvgpu in a POSIX compliant userspace.
This code adds all of the necessary abstraction interfaces (mostly
stubbed) to enabled extremely limited and basic functionality in
nvgpu.

The goal of this code is to facilitate unit testing of the nvgpu
common core. By doing this in userspace it is much easier to write
tests that rely on very particular states within nvgpu since a user
can very precisely control the state of nvgpu.

JIRA NVGPU-525

Change-Id: I30e95016df14997d951075777e0585f912dc5960
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1683914
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-05-07 04:41:26 -07:00