Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Sokolkov r7vme

View GitHub Profile
View test_lib_test_case.cpp
TEST_CASE("if more than one core then return true", "[is_multicore_system]")
{
// always reset globally-defined fff objects
// This is a limitation of pure-C fff, that it uses global objects.
RESET_FAKE(__wrap_get_nprocs_conf);
// if get_nprocs_conf will return 2
__wrap_get_nprocs_conf_fake.return_val = 2;
// then return true
View test_lib_define.cpp
FAKE_VALUE_FUNC(int, __wrap_get_nprocs_conf);
View test_lib_include.cpp
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
// this in one cpp file
#include <catch2/catch.hpp>
#include <fff/fff.h>
DEFINE_FFF_GLOBALS;
View test_lib.cpp
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
// this in one cpp file
#include <catch2/catch.hpp>
#include <fff/fff.h>
DEFINE_FFF_GLOBALS;
extern "C" {
// include our library header
#include "lib.h"
View main.c
#include <sys/sysinfo.h>
#include <stdio.h>
#include <stdbool.h>
bool is_multicore_system(void) {
return (get_nprocs_conf() > 1) ? true : false;
}
// wrapper emulates single processor system
int __wrap_get_nprocs_conf() { return 1; }
View is_multicore_system.c
bool is_multicore_system(void) {
return (get_nprocs_conf() > 1) ? true : false;
}
View gist:c103dd227bd512a1be9302c2dafc7c82
info: reading kernel config from /proc/config.gz ...
Generally Necessary:
- cgroup hierarchy: properly mounted [/sys/fs/cgroup]
- CONFIG_NAMESPACES: enabled
- CONFIG_NET_NS: enabled
- CONFIG_PID_NS: enabled
- CONFIG_IPC_NS: enabled
- CONFIG_UTS_NS: enabled
- CONFIG_CGROUPS: enabled
View gist:4f738d03f64f2657d6f7b397df6dec08
FROM ubuntu:18.04
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ROS_DISTRO dashing
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -q -y \
curl \
gnupg2 \
lsb-release \
&& rm -rf /var/lib/apt/lists/*
View gist:45ad34e9c2e8d8cd1c01d94975ee6bee
Device 0: "NVIDIA Tegra X1"
CUDA Driver Version / Runtime Version 10.0 / 10.0
CUDA Capability Major/Minor version number: 5.3
Total amount of global memory: 3965 MBytes (4157145088 bytes)
( 1) Multiprocessors, (128) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 922 MHz (0.92 GHz)
Memory Clock rate: 13 Mhz
Memory Bus Width: 64-bit
L2 Cache Size: 262144 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
View register_in_header.hpp
REGISTER_TENSORRT_PLUGIN(L2NormHelperPluginCreator);