#include #include #include "tests.h" #include "cpumap.h" #include "debug.h" #define NBITS 100 static unsigned long *get_bitmap(const char *str, int nbits) { struct cpu_map *map = cpu_map__new(str); unsigned long *bm = NULL; int i; bm = bitmap_alloc(nbits); if (map && bm) { bitmap_zero(bm, nbits); for (i = 0; i < map->nr; i++) set_bit(map->map[i], bm); } if (map) cpu_map__put(map); return bm; } static int test_bitmap(const char *str) { unsigned long *bm = get_bitmap(str, NBITS); char buf[100]; int ret; bitmap_scnprintf(bm, NBITS, buf, sizeof(buf)); pr_debug("bitmap: %s\n", buf); ret = !strcmp(buf, str); free(bm); return ret; } int test__bitmap_print(int subtest __maybe_unused) { TEST_ASSERT_VAL("failed to convert map", test_bitmap("1")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,5")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,3,5,7,9,11,13,15,17,19,21-40")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("2-5")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,3-6,8-10,24,35-37")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,3-6,8-10,24,35-37")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1-10,12-20,22-30,32-40")); return 0; } ption> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-05 23:06:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-05 23:06:06 -0800
commit6989606a7224a2d5a925df22a49e4f7a0bfed0d6 (patch)
tree2fb686a4dea9a7f4beec97fde510f2840c8e06f9 /include/net/codel_qdisc.h
parented40875dd4b4c7b5c991db9e06c984180ab0b3ce (diff)
parentbe29d20f3f5db1f0b4e49a4f6eeedf840e2bf9b1 (diff)
Merge branch 'stable-4.10' of git://git.infradead.org/users/pcmoore/audit
Pull audit fixes from Paul Moore: "Two small fixes relating to audit's use of fsnotify. The first patch plugs a leak and the second fixes some lock shenanigans. The patches are small and I banged on this for an afternoon with our testsuite and didn't see anything odd" * 'stable-4.10' of git://git.infradead.org/users/pcmoore/audit: audit: Fix sleep in atomic fsnotify: Remove fsnotify_duplicate_mark()
Diffstat (limited to 'include/net/codel_qdisc.h')