diff --git a/test/compiler/make64_test.plt b/test/compiler/make64_test.plt
index 95a6c2d0f7f3db8ec5ab8c2e6c0663b6569d4a9f..745f080048582472a29a83f55361aa4542b831ba 100644
--- a/test/compiler/make64_test.plt
+++ b/test/compiler/make64_test.plt
@@ -2,44 +2,15 @@
 # Instead, run make64_test.t inside O.$(EPICS_HOST_ARCH)
 
 use strict;
-use Test::More;
-
-my $success = {
-};
-
-my $error = {
-  tooLong => undef,
-  varinit => undef,
-  varinitOptr => undef,
-};
-
-sub do_test {
-  my ($test) = @_;
-  $_ = `make -B -s TESTPROD=$test 2>&1`;
-  # uncomment this comment to find out what went wrong:
-  #diag("$test result=$?, response=$_");
-}
-
-sub check_success {
-  ok($? != -1 and $? == 0 and not /error/);
-}
-
-sub check_error {
-  my $ne = 0;
-  ok($? != -1 and $? != 0);
-}
-
-plan tests => keys(%$success) + keys(%$error);
-
-my @alltests = (
-  [\&check_success, $success],
-  [\&check_error, $error],
+use lib "..";
+use make_test_lib;
+
+make_test_lib::do_tests(
+  success => [qw(
+  )],
+  failure => [qw(
+    tooLong
+    varinit
+    varinitOptr
+  )]
 );
-
-foreach my $group (@alltests) {
-  my ($check,$tests) = @$group;
-  foreach my $test (sort(keys(%$tests))) {
-    do_test($test);
-    &$check();
-  }
-}
diff --git a/test/compiler/make_test.plt b/test/compiler/make_test.plt
index 5e9fb429a797c4c836ac7b3f9976c1957cebdae0..8c1be424f095c75de7715625ab88543638072000 100644
--- a/test/compiler/make_test.plt
+++ b/test/compiler/make_test.plt
@@ -2,44 +2,15 @@
 # Instead, run make_test.t inside O.$(EPICS_HOST_ARCH)
 
 use strict;
-use Test::More;
-
-my $success = {
-  tooLong => undef,
-};
-
-my $error = {
-  varinit => undef,
-  varinitOptr => undef,
-};
-
-sub do_test {
-  my ($test) = @_;
-  $_ = `make -B -s TESTPROD=$test 2>&1`;
-  # uncomment this comment to find out what went wrong:
-  #diag("$test result=$?, response=$_");
-}
-
-sub check_success {
-  ok($? != -1 and $? == 0 and not /error/);
-}
-
-sub check_error {
-  my $ne = 0;
-  ok($? != -1 and $? != 0);
-}
-
-plan tests => keys(%$success) + keys(%$error);
-
-my @alltests = (
-  [\&check_success, $success],
-  [\&check_error, $error],
+use lib "..";
+use make_test_lib;
+
+make_test_lib::do_tests(
+  success => [qw(
+    tooLong
+  )],
+  failure => [qw(
+    varinit
+    varinitOptr
+  )]
 );
-
-foreach my $group (@alltests) {
-  my ($check,$tests) = @$group;
-  foreach my $test (sort(keys(%$tests))) {
-    do_test($test);
-    &$check();
-  }
-}
diff --git a/test/compiler/make_test_lib.pm b/test/compiler/make_test_lib.pm
new file mode 100644
index 0000000000000000000000000000000000000000..75edd9abe066e245d488eec630e5d9db1ed75194
--- /dev/null
+++ b/test/compiler/make_test_lib.pm
@@ -0,0 +1,42 @@
+package make_test_lib;
+
+use strict;
+use Test::More;
+
+sub do_test {
+  my ($test) = @_;
+  $_ = `make -B -s TESTPROD=$test 2>&1`;
+  # uncomment this comment to find out what went wrong:
+  #diag("$test result=$?, response=$_");
+}
+
+sub check_success {
+  ok($? != -1 and $? == 0 and not /error/);
+}
+
+sub check_failure {
+  my $ne = 0;
+  ok($? != -1 and $? != 0);
+}
+
+sub do_tests {
+  my %tests = @_;
+
+  my @alltests = (
+    [\&check_success, $tests{success}],
+    [\&check_failure, $tests{failure}],
+  );
+
+  plan tests => @{$tests{success}} + @{$tests{failure}};
+
+  foreach my $group (@alltests) {
+    my ($check,$tests) = @$group;
+    foreach my $test (@$tests) {
+      do_test($test);
+      &$check();
+    }
+  }
+
+}
+
+1;