[PATCH v18 00/19] kunit: introduce KUnit, the Linux kernel unit testing framework
by Brendan Higgins
## TL;DR
This revision addresses comments from Linus[1] and Randy[2], by moving
top level `kunit/` directory to `lib/kunit/` and likewise moves top
level Kconfig entry under lib/Kconfig.debug, so the KUnit submenu now
shows up under the "Kernel Hacking" menu.
As a consequence of this, I rewrote patch 06/18 (kbuild: enable building
KUnit) - now 06/19 (lib: enable building KUnit in lib/), and now needs
to be re-acked/reviewed.
## Background
This patch set proposes KUnit, a lightweight unit testing and mocking
framework for the Linux kernel.
Unlike Autotest and kselftest, KUnit is a true unit testing framework;
it does not require installing the kernel on a test machine or in a VM
(however, KUnit still allows you to run tests on test machines or in VMs
if you want[3]) and does not require tests to be written in userspace
running on a host kernel. Additionally, KUnit is fast: From invocation
to completion KUnit can run several dozen tests in about a second.
Currently, the entire KUnit test suite for KUnit runs in under a second
from the initial invocation (build time excluded).
KUnit is heavily inspired by JUnit, Python's unittest.mock, and
Googletest/Googlemock for C++. KUnit provides facilities for defining
unit test cases, grouping related test cases into test suites, providing
common infrastructure for running tests, mocking, spying, and much more.
### What's so special about unit testing?
A unit test is supposed to test a single unit of code in isolation,
hence the name. There should be no dependencies outside the control of
the test; this means no external dependencies, which makes tests orders
of magnitudes faster. Likewise, since there are no external dependencies,
there are no hoops to jump through to run the tests. Additionally, this
makes unit tests deterministic: a failing unit test always indicates a
problem. Finally, because unit tests necessarily have finer granularity,
they are able to test all code paths easily solving the classic problem
of difficulty in exercising error handling code.
### Is KUnit trying to replace other testing frameworks for the kernel?
No. Most existing tests for the Linux kernel are end-to-end tests, which
have their place. A well tested system has lots of unit tests, a
reasonable number of integration tests, and some end-to-end tests. KUnit
is just trying to address the unit test space which is currently not
being addressed.
### More information on KUnit
There is a bunch of documentation near the end of this patch set that
describes how to use KUnit and best practices for writing unit tests.
For convenience I am hosting the compiled docs here[4].
Additionally for convenience, I have applied these patches to a
branch[5]. The repo may be cloned with:
git clone https://kunit.googlesource.com/linux
This patchset is on the kunit/initial/v5.3/v18 branch.
## History since v15
### v18
- Addrssed comments on 07/19 (kunit: test: add initial tests) from
Randy Dunlap by removing redundant dependencies from Kconfig entries.
### v17
- Addressed comments on 06/19 (lib: enable building KUnit in lib/) from
Stephen Boyd by moving KUnit submenu ahead of Runtime Testing
submenu.
### v16
- Addressed comments from Linus Torvalds by moving all kunit/ paths to
lib/kunit/.
- Addressed comments by Randy Dunlap by moving KUnit Kconfig under
lib/Kconfig.debug so the KUnit submenu shows up under the "Kernel
Hacking" menu.
[1] https://www.lkml.org/lkml/2019/9/20/696
[2] https://www.lkml.org/lkml/2019/9/20/738
[3] https://google.github.io/kunit-docs/third_party/kernel/docs/usage.html#ku...
[4] https://google.github.io/kunit-docs/third_party/kernel/docs/
[5] https://kunit.googlesource.com/linux/+/kunit/initial/v5.3/v18
---
Avinash Kondareddy (1):
kunit: test: add tests for KUnit managed resources
Brendan Higgins (16):
kunit: test: add KUnit test runner core
kunit: test: add test resource management API
kunit: test: add string_stream a std::stream like string builder
kunit: test: add assertion printing library
kunit: test: add the concept of expectations
lib: enable building KUnit in lib/
kunit: test: add initial tests
objtool: add kunit_try_catch_throw to the noreturn list
kunit: test: add support for test abort
kunit: test: add tests for kunit test abort
kunit: test: add the concept of assertions
kunit: defconfig: add defconfigs for building KUnit tests
Documentation: kunit: add documentation for KUnit
MAINTAINERS: add entry for KUnit the unit testing framework
MAINTAINERS: add proc sysctl KUnit test to PROC SYSCTL section
kunit: fix failure to build without printk
Felix Guo (1):
kunit: tool: add Python wrappers for running KUnit tests
Iurii Zaikin (1):
kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/kunit/api/index.rst | 16 +
Documentation/dev-tools/kunit/api/test.rst | 11 +
Documentation/dev-tools/kunit/faq.rst | 62 +
Documentation/dev-tools/kunit/index.rst | 79 +
Documentation/dev-tools/kunit/start.rst | 180 ++
Documentation/dev-tools/kunit/usage.rst | 576 +++++++
MAINTAINERS | 13 +
arch/um/configs/kunit_defconfig | 3 +
include/kunit/assert.h | 356 ++++
include/kunit/string-stream.h | 51 +
include/kunit/test.h | 1490 +++++++++++++++++
include/kunit/try-catch.h | 75 +
kernel/Makefile | 2 +
kernel/sysctl-test.c | 392 +++++
lib/Kconfig.debug | 13 +
lib/Makefile | 2 +
lib/kunit/Kconfig | 36 +
lib/kunit/Makefile | 9 +
lib/kunit/assert.c | 141 ++
lib/kunit/example-test.c | 88 +
lib/kunit/string-stream-test.c | 52 +
lib/kunit/string-stream.c | 217 +++
lib/kunit/test-test.c | 331 ++++
lib/kunit/test.c | 478 ++++++
lib/kunit/try-catch.c | 118 ++
tools/objtool/check.c | 1 +
tools/testing/kunit/.gitignore | 3 +
tools/testing/kunit/configs/all_tests.config | 3 +
tools/testing/kunit/kunit.py | 136 ++
tools/testing/kunit/kunit_config.py | 66 +
tools/testing/kunit/kunit_kernel.py | 149 ++
tools/testing/kunit/kunit_parser.py | 310 ++++
tools/testing/kunit/kunit_tool_test.py | 206 +++
.../test_is_test_passed-all_passed.log | 32 +
.../test_data/test_is_test_passed-crash.log | 69 +
.../test_data/test_is_test_passed-failure.log | 36 +
.../test_is_test_passed-no_tests_run.log | 75 +
.../test_output_isolated_correctly.log | 106 ++
.../test_data/test_read_from_file.kconfig | 17 +
40 files changed, 6001 insertions(+)
create mode 100644 Documentation/dev-tools/kunit/api/index.rst
create mode 100644 Documentation/dev-tools/kunit/api/test.rst
create mode 100644 Documentation/dev-tools/kunit/faq.rst
create mode 100644 Documentation/dev-tools/kunit/index.rst
create mode 100644 Documentation/dev-tools/kunit/start.rst
create mode 100644 Documentation/dev-tools/kunit/usage.rst
create mode 100644 arch/um/configs/kunit_defconfig
create mode 100644 include/kunit/assert.h
create mode 100644 include/kunit/string-stream.h
create mode 100644 include/kunit/test.h
create mode 100644 include/kunit/try-catch.h
create mode 100644 kernel/sysctl-test.c
create mode 100644 lib/kunit/Kconfig
create mode 100644 lib/kunit/Makefile
create mode 100644 lib/kunit/assert.c
create mode 100644 lib/kunit/example-test.c
create mode 100644 lib/kunit/string-stream-test.c
create mode 100644 lib/kunit/string-stream.c
create mode 100644 lib/kunit/test-test.c
create mode 100644 lib/kunit/test.c
create mode 100644 lib/kunit/try-catch.c
create mode 100644 tools/testing/kunit/.gitignore
create mode 100644 tools/testing/kunit/configs/all_tests.config
create mode 100755 tools/testing/kunit/kunit.py
create mode 100644 tools/testing/kunit/kunit_config.py
create mode 100644 tools/testing/kunit/kunit_kernel.py
create mode 100644 tools/testing/kunit/kunit_parser.py
create mode 100755 tools/testing/kunit/kunit_tool_test.py
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-all_passed.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-crash.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-failure.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-no_tests_run.log
create mode 100644 tools/testing/kunit/test_data/test_output_isolated_correctly.log
create mode 100644 tools/testing/kunit/test_data/test_read_from_file.kconfig
--
2.23.0.351.gc4317032e6-goog
1 year, 3 months
RE: LOAN & INVESTMENT NOW READY. SEE INSIDE FOR DETAILS
by BBK LOANS & INVESTMENT CO
Dear Sir/Ma'am
We have set aside $100 Billion US Dollars for our loans
program. BBK LOANS & INVESTMENT CO issues loan grants between
$100,000 - $100,000,000. We offer at affordable interest rate of
3% within a period of 5-10 years repayment period.
This program is available to all credible and honest loan seekers
who are in need of a business loan, home mortgages, real estates
etc.
Fill in the blank spaces for full application:
1. Full Name:
2. Address:
3. Occupation:
4. Date of Birth:
5. Man/Woman:
6. Nationality:
7. Country Where You Now Live:
8. Mobile No:
9. Loan Amount:
You can contact us immediately by sending the above mentioned
information to our email here below;
Ms. Elham Ibrahim Hassan
Operations Director
Email: bbkloanscompany(a)aol.com
3666, Nanhai Ave.,
Wuhan, Hubei, 430072
P.R China.
1 year, 3 months
Бюджет доходов и расходов
by Dinara
Для просмотра web-версии письма кликните online
Бюджетирование с шаблонами бюджетов и финансовой моделью
Продолжительность 4 часа - только Практика!
Цель:
В течение 4 часов слушателям будет предоставлена только практика организации бюджетного управления в компании, как рассчитать бюджеты компании, какова должна быть структура бюджетов, как распределить зоны финансовой ответственности – кто за какие цифры должен отвечать В чем особенность данной программы:
В том, что его участники смогут, получить практический материал, а именно:
- Финансовую модель прогнозирования (в Excel) для постановки целей компании и сотрудникам, «что-если», постановки и декомпозиции финансовых целей
- Шаблоны бюджетов с формулами и консолидацией (в Excel) в Бюджет доходов и расходов, Бюджет движения денежных средств, Бюджет по балансовому листу
- Положение о бюджетировании
- Учетную политику Повестка дня:
Модуль 1. Организация Бюджетного Управления
- Как быстро привести дела в порядок в финансах;
- Бюджетирование в удовольствие: получай готовые бюджеты и вноси свои цифры;
- Что нам хочет сказать прибыль?
- Что делают выдающиеся финансисты иначе: Практика лучших финансистов;
- Говори на языке цифр. Арифметика прибыли.
- Центры финансовой ответственности (ЦФО). Кто за какие показатели отвечает в компании
- KPI и нормативы подразделений
- Как оперативно и эффективно управлять финансовыми результатами с помощью бюджетов
- Бюджетирование сверху вниз и снизу вверх.
- Прогнозы и планы. В чем отличие? Прогнозирование за 10 минут
- Что выбрать статичный бюджет или скользящее планирование
- Основные виды бюджетов – операционные, инвестиционные и финансовые бюджеты
Модуль 2. Техники Формирования Бюджетов Компании Подразделений
Модуль рассматривается на практическом примере, в котором представлены все нижеперечисленные бюджеты в Excel, созданные тренерами с готовыми формулами.
Бюджетная структура компании и финансовые бюджеты компании
- Бюджет доходов и расходов (прибылей и убытков) по статьям и по элементам
- Бюджет движения денежных средств, Прогнозный баланс, Как они формируются
Функциональные бюджеты
- Бюджет продаж, Бюджет поступлений от клиентов, Бюджет дебиторской задолженности
- Бюджет валовой прибыли, Бюджет товарных остатков, Бюджет себестоимости реализации
- Бюджет закупок по себестоимости и закупочной стоимости, Бюджет оплат поставщикам, Бюджет кредиторской задолженности
- Бюджетирование расходов на персонал, Бюджет выплат персоналу, Бюджет обязательств по выплатам персоналу
- Бюджет налогов на фонд оплаты труда (ФОТ), Бюджет выплат налогов, Бюджет выплат
- Бюджет командировочных расходов
- Бюджет налогов, Бюджет финансовой деятельности, Бюджет инвестиционной деятельности
Бюджеты подразделений. Бюджеты по ЦФО
- Основные показатели подразделений. За что они должны отвечать. Как установить директивы подразделениям
- Бюджеты доходообразующих подразделений: Бюджет отдела продаж, службы маркетинга
- Бюджеты сервисных подразделений: Бюджет склада, транспортно-экспедиционной службы, административно-хозяйственной службы, финансовой службы и бухгалтерии, бюджет ИТ, службы персонала, управления
Ведущий:
Немировский Игорь Борисович – генеральный директор тренингово-консалтинговой компании, консультант, имеющий опыт 21 год управления и 14 летний опыт работы финансовым директором в компаниях лидерах рынка. Автор более 50 публикаций в т.ч. книг «Бюджетирование. От стратегии до бюджета пошаговое руководство», «Система сбалансированных показателей: внедрение, оценка деятельности компании». Эксперт по вопросам финансового управления, результативного руководства, стратегии и постановки системы управления бизнесом.
Старожукова Инна Альбертовна – бизнес-тренер с более чем 18-ти летним практическим опытом управления финансами холдинговых структур крупного бизнеса. Эксперт-практик в области финансов, бюджетирования, системы сбалансированных показателей, управленческого учета, анализа и отчетности. Огромный опыт формирования системы управленческого учета и контролинга, постановки технических заданий для внедрения ERP-систем для группы компаний, формализации бизнес процессов компании.
Дата и место проведения: 17 октября
Регламент: 9.30-14.00.
Регистрация с 9.00 в холле.
Стоимость участия:
3,800.00 грн. - за одного участника.
Для второго и третьего участника скидки 5% и 7% соответственно
В стоимость входит: информационно-консультационное обслуживание, сборник материалов, кофе-брейк, обед в ресторане, обсуждение докладов и обмен мнениями с тренером.
Последние обновления на сайте
Маркетинг
Бюджетирование и финансы
Менеджмент
Интернет
Новости
Если у Вас возникнут дополнительные вопросы - обращайтесь, мы всегда рады Вам помочь!
Связаться с нами: +38 /044/ 237 90 05
E-mail: info(a)deloproizvodstvo.in.ua
Web: deloproizvodstvo.in.ua
List-Unsubscribe | Пожаловаться на Spam
1 year, 3 months
Independent Financial Consultant @,,
by Mr. Ryan Roger
Good Day ,
My name is Mr. Ryan Rogers the Independent Financial Consultant. We are contacting you concerning funding of your business project. We are interested to partnership with you as we are seeking to diversify our financial portfolio into viable and lucrative business projects that worth it,
We are most interested in partnerships business ventures in Medical and Health care projects, Real estate projects, mining projects, agricultural projects renewable energy projects, Oil and Gas, start-up projects and business expansions / Loan with lower rate,
Your swift response is highly needed.
Best Regard,
Ryan Roger
1 year, 3 months
Happy to inform you, CONTACT WALMART TRANSFER To pick up $8000.00
sent to you this morning.
by jpmorganchasebank.ny13@yahoo.com
Attn Dear Beneficiary.
Happy to inform you, CONTACT WALMART TRANSFER To pick up $8000.00 sent to you this morning.
I have deposited your payment funds $2.500,000MillionUS Dollars
With Walmart international money transfers.
Receive the Money with Walmart | MoneyGram service.
Walmart partners with MoneyGram to allow customers
easily receive money transfers abroad,
Contact Walmart international money transfers office -Benin
Receive your approval payment funds $10.500,000MillionUS Dollars
HERE IS WALMART CONTACT INFORMATIONS.
Contact person. Mrs. Mary Anderson,Dir. Walmart transfers-Benin
Email: walmart.b100263(a)gmail.com
Telephone. +229 68823234
Text Her on this international phone line. (256) 284-4886
Ask Mrs. Mary Anderson,Dir. Walmart transfers-Benin to send the transfer
as i instructed.
we agreed to keep sending the transfer to you $8000.00 daily.
Until you received your total payment $10.500,000 from the office
Once again,
make sure you contact Mrs. Mary Anderson,Dir. Walmart transfers-Benin
today including your infos.
(1) Your Full Name==============
(2) house address=============
(3) Your Phone Numbers=============
Urgent to receive your transfer now without any further delay.
Finally, Send your first payment transfer fees to Walmart office on below address
Receiver's Name====== ALAN UDE
Country=====BENIN
City=======COTONOU
AMOUNT =====$58.00 only. Your first payment $8000.00 transfer fee.
Question======God
Answer=========Creator
Thanks
DR.Mike Benz
1 year, 3 months
High danger. Your account was attacked.
by linux-nvdimm@lists.01.org
Hello!
As you may have noticed, I sent you an email from your account.
This means that I have full access to your device.
I've been watching you for a few months now.
The fact is that you were infected with malware through an adult site that you visited.
If you are not familiar with this, I will explain.
Trojan Virus gives me full access and control over a computer or other device.
This means that I can see everything on your screen, turn on the camera and microphone, but you do not know about it.
I also have access to all your contacts and all your correspondence.
Why your antivirus did not detect malware?
Answer: My malware uses the driver, I update its signatures every 4 hours so that your antivirus is silent.
I made a video showing how you satisfy yourself in the left half of the screen, and in the right half you see the video that you watched.
With one click of the mouse, I can send this video to all your emails and contacts on social networks.
I can also post access to all your e-mail correspondence and messengers that you use.
If you want to prevent this,
transfer the amount of $797 to my bitcoin address (if you do not know how to do this, write to Google: "Buy Bitcoin").
My bitcoin address (BTC Wallet) is: 14wJMVaw6GuMo64RB4HwfuhSraX8UmUxEU
After receiving the payment, I will delete the video and you will never hear me again.
I give you 50 hours (more than 2 days) to pay.
I have a notice reading this letter, and the timer will work when you see this letter.
Filing a complaint somewhere does not make sense because this email cannot be tracked like my bitcoin address.
I do not make any mistakes.
If I find that you have shared this message with someone else, the video will be immediately distributed.
Best regards!
1 year, 3 months
Security Alert. Your accounts was hacked by criminal group.
by linux-nvdimm@lists.01.org
Hello!
As you may have noticed, I sent you an email from your account.
This means that I have full access to your device.
I've been watching you for a few months now.
The fact is that you were infected with malware through an adult site that you visited.
If you are not familiar with this, I will explain.
Trojan Virus gives me full access and control over a computer or other device.
This means that I can see everything on your screen, turn on the camera and microphone, but you do not know about it.
I also have access to all your contacts and all your correspondence.
Why your antivirus did not detect malware?
Answer: My malware uses the driver, I update its signatures every 4 hours so that your antivirus is silent.
I made a video showing how you satisfy yourself in the left half of the screen, and in the right half you see the video that you watched.
With one click of the mouse, I can send this video to all your emails and contacts on social networks.
I can also post access to all your e-mail correspondence and messengers that you use.
If you want to prevent this,
transfer the amount of $777 to my bitcoin address (if you do not know how to do this, write to Google: "Buy Bitcoin").
My bitcoin address (BTC Wallet) is: 14wJMVaw6GuMo64RB4HwfuhSraX8UmUxEU
After receiving the payment, I will delete the video and you will never hear me again.
I give you 50 hours (more than 2 days) to pay.
I have a notice reading this letter, and the timer will work when you see this letter.
Filing a complaint somewhere does not make sense because this email cannot be tracked like my bitcoin address.
I do not make any mistakes.
If I find that you have shared this message with someone else, the video will be immediately distributed.
Best regards!
1 year, 3 months
[ndctl PATCH] libdaxctl: fix memory leaks with daxctl_memory objects
by Vishal Verma
The daxctl_dev_alloc_mem() helper which is used to instantiate a new
memory object did so, but neglected to attach the memory object to the
parent 'dev' object. As a result, every invocation of
'daxctl_dev_get_memory() resulted in a new, orphan memory object being
created, which also resulted in libdaxctl leaking memory.
Fix the parent association for 'mem' objects, and in free_mem, remove
the check for 'dev' being present - mem objects will always associated
with a dev.
Additionally, we were neglecting to free 'mem->mem_buf' in free_mem, so
fix this up as well.
Fixes: e8bf803e359b ("libdaxctl: add a 'daxctl_memory' object for memory based operations")
Link: https://github.com/pmem/ndctl/issues/112
Reported-by: Michal Biesek <michal.biesek(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
daxctl/lib/libdaxctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index 8abfd64..639224c 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -204,8 +204,9 @@ DAXCTL_EXPORT void daxctl_region_get_uuid(struct daxctl_region *region, uuid_t u
static void free_mem(struct daxctl_dev *dev)
{
- if (dev && dev->mem) {
+ if (dev->mem) {
free(dev->mem->node_path);
+ free(dev->mem->mem_buf);
free(dev->mem);
dev->mem = NULL;
}
@@ -450,6 +451,7 @@ static struct daxctl_memory *daxctl_dev_alloc_mem(struct daxctl_dev *dev)
goto err_node;
mem->buf_len = strlen(node_base) + 256;
+ dev->mem = mem;
return mem;
err_node:
--
2.20.1
1 year, 3 months