struct test_env {
        const char *type;
        const char *subtest;
+       const char *prepend;
 
        int test_num;
        int subtest_num;
 
 struct test_env env;
 
+struct sockmap_options {
+       int verbose;
+       bool base;
+       bool sendpage;
+       bool data_test;
+       bool drop_expected;
+       int iov_count;
+       int iov_length;
+       int rate;
+       char *map;
+       char *whitelist;
+       char *blacklist;
+       char *prepend;
+};
+
+struct _test {
+       char *title;
+       void (*tester)(int cg_fd, struct sockmap_options *opt);
+};
+
 static void test_start(void)
 {
        env.subtest_num++;
        txmsg_ingress = txmsg_skb = 0;
 }
 
-static int test_start_subtest(const char *name, const char *type)
+static int test_start_subtest(const struct _test *t, struct sockmap_options *o)
 {
-       env.type = type;
-       env.subtest = name;
+       env.type = o->map;
+       env.subtest = t->title;
+       env.prepend = o->prepend;
        env.test_num++;
        env.subtest_num = 0;
        env.fail_last = env.fail_cnt;
        if (!error)
                test_pass();
 
-       fprintf(stdout, "#%2d/%2d %8s:%s:%s\n",
+       fprintf(stdout, "#%2d/%2d %8s:%s:%s:%s\n",
                env.test_num, env.subtest_num,
                !type ? "sockmap" : "sockhash",
+               env.prepend ? : "",
                env.subtest, error ? "FAIL" : "OK");
 }
 
        struct timespec end;
 };
 
-struct sockmap_options {
-       int verbose;
-       bool base;
-       bool sendpage;
-       bool data_test;
-       bool drop_expected;
-       int iov_count;
-       int iov_length;
-       int rate;
-       char *map;
-       char *whitelist;
-       char *blacklist;
-};
-
 static int msg_loop_sendpage(int fd, int iov_length, int cnt,
                             struct msg_stats *s,
                             struct sockmap_options *opt)
        return 0;
 }
 
-struct _test {
-       char *title;
-       void (*tester)(int cg_fd, struct sockmap_options *opt);
-};
-
 struct _test test[] = {
        {"txmsg test passthrough", test_txmsg_pass},
        {"txmsg test redirect", test_txmsg_redir},
                return -ENOMEM;
        entry = strtok(ptr, ",");
        while (entry) {
-               if (strstr(opt->map, entry) != 0 || strstr(t->title, entry) != 0)
+               if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
+                   strstr(opt->map, entry) != 0 ||
+                   strstr(t->title, entry) != 0)
                        return 0;
                entry = strtok(NULL, ",");
        }
                return -ENOMEM;
        entry = strtok(ptr, ",");
        while (entry) {
-               if (strstr(opt->map, entry) != 0 || strstr(t->title, entry) != 0)
+               if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
+                   strstr(opt->map, entry) != 0 ||
+                   strstr(t->title, entry) != 0)
                        return 0;
                entry = strtok(NULL, ",");
        }
                if (check_blacklist(&t, opt) == 0)
                        continue;
 
-               test_start_subtest(t.title, opt->map);
+               test_start_subtest(&t, opt);
                t.tester(cg_fd, opt);
                test_end_subtest();
        }
        __test_selftests(cg_fd, opt);
 }
 
+static void test_selftests_ktls(int cg_fd, struct sockmap_options *opt)
+{
+       opt->map = BPF_SOCKHASH_FILENAME;
+       opt->prepend = "ktls";
+       ktls = 1;
+       __test_selftests(cg_fd, opt);
+       ktls = 0;
+}
+
 static int test_selftest(int cg_fd, struct sockmap_options *opt)
 {
 
        test_selftests_sockmap(cg_fd, opt);
        test_selftests_sockhash(cg_fd, opt);
+       test_selftests_ktls(cg_fd, opt);
        test_print_results();
        return 0;
 }