| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | /* |
| 3 | * License: GPLv3+ |
| 4 | * Copyright (c) 2016 Davide Madrisan <[email protected]> |
| 5 | * |
| 6 | * Unit test for lib/kernelver.c |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation, either version 3 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #include <linux/version.h> |
| 24 | |
| 25 | #include "common.h" |
| 26 | #include "kernelver.h" |
| 27 | #include "testutils.h" |
| 28 | |
| 29 | static int |
| 30 | mymain (void) |
| 31 | { |
| 32 | #ifdef KERNEL_VERSION |
| 33 | int ret = 0; |
| 34 | unsigned int lnxver = linux_version (); |
| 35 | |
| 36 | TEST_ASSERT_EQUAL_NUMERIC (lnxver, |
| 37 | KERNEL_VERSION (TEST_KERNEL_VERSION_MAJOR, |
| 38 | TEST_KERNEL_VERSION_MINOR, |
| 39 | TEST_KERNEL_VERSION_PATCH)); |
| 40 | return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; |
| 41 | #else |
| 42 | return EXIT_AM_SKIP; |
| 43 | #endif |
| 44 | } |
| 45 | |
| 46 | TEST_MAIN_PRELOAD (mymain, abs_builddir "/.libs/tslibuname.so"); |