Skip to content

Commit

Permalink
Merge pull request #62 from peppelakappa/master
Browse files Browse the repository at this point in the history
let the test pass on kernel >= 4
  • Loading branch information
dgraziotin committed May 5, 2015
2 parents c3209df + 2f8946d commit f5552f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/minunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ static const char *test_is_legacy_kernel()

struct utsname kernel;
uname(&kernel);

int kern_major_release = (int)(kernel.release[0] - '0');

mu_assert("Kernel major version is not 3.", kernel.release[0] == '3');

mu_assert("Kernel major version is minor than 3.", kern_major_release > 2);
char *pch;
pch = strtok(kernel.release, ".");
pch = strtok(NULL, ".");

int minor = atoi(pch);

if (minor < 15)
if ((kern_major_release <= 3) && minor < 15)
mu_assert("Legacy kernel not detected by mbpfan.", is_legacy_kernel() == 1);
else
mu_assert("Non-legacy kernel not detected by mbpfan", is_legacy_kernel() == 0);
Expand Down Expand Up @@ -214,6 +215,7 @@ int tests()
{
printf("Starting the tests..\n");
printf("It is normal for them to take a bit to finish.\n");

const char *result = all_tests();

if (result != 0) {
Expand All @@ -226,4 +228,4 @@ int tests()
printf("Tests run: %d\n", tests_run);

return result != 0;
}
}

0 comments on commit f5552f8

Please sign in to comment.