[hawkmoth] [PATCH 3/8] test: switch to using python unittests over cmdtest

  • From: Jani Nikula <jani@xxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx
  • Date: Thu, 13 Dec 2018 23:11:28 +0200

The cmdtest thing is a bit clunky.
---
 test/Makefile.local   | 36 ++++++++----------------------------
 test/hawkmoth-wrapper |  8 --------
 2 files changed, 8 insertions(+), 36 deletions(-)
 delete mode 100755 test/hawkmoth-wrapper

diff --git a/test/Makefile.local b/test/Makefile.local
index 178f773eeae1..6eeb06a155f2 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -1,36 +1,16 @@
 # -*- makefile -*-
+# Copyright (c) 2017-2018, Jani Nikula <jani@xxxxxxxxxx>
+# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
 #
-# Tests based on cmdtest(1)
-#
-# Deviations from standard cmdtest usage:
-# - Uses .script symlinks to shared hawkmoth-wrapper.
-# - Uses .c for input files.
-# - Uses .stdin for additional arguments to hawkmoth.
-#
-# FIXME: This is *completely* inadequate. Needs to take into account compat
-# options for Javadoc and check for different input. Needs more test data, in
-# particular more pathological real world test data. Needs a way to flag broken
-# tests for TDD. Needs to run the directive extension too, not just the comment
-# extraction part.
+# FIXME: This is inadequate. Needs more test data, in particular more
+# pathological real world test data. Needs to run the directive extension too,
+# not just the comment extraction part.
 #
 
 dir := test
 
-CMDTEST := cmdtest
-LN := ln
-
-# Existence of .c defines the test, not .script.
-TEST:=$(wildcard $(dir)/*.c)
-CMDTEST_CLEAN=$(TEST:%.c=%.stderr-actual) $(TEST:%.c=%.stderr-diff)    \
-       $(TEST:%.c=%.stdout-actual) $(TEST:%.c=%.stdout-diff)
-
-# Use a shared .script.
-SCRIPT:=$(TEST:%.c=%.script)
-%.script:
-       $(call quiet,LN) -sf hawkmoth-wrapper $@
+TESTS := $(wildcard $(dir)/test_*.py)
 
 .PHONY: test
-test: $(SCRIPT)
-       $(call quiet,CMDTEST,CMDTEST) test
-
-CLEAN := $(CLEAN) $(SCRIPT) $(CMDTEST_CLEAN)
+test:
+       @$(foreach test,$(TESTS),echo $(test); $(test);)
diff --git a/test/hawkmoth-wrapper b/test/hawkmoth-wrapper
deleted file mode 100755
index bc05839cd71e..000000000000
--- a/test/hawkmoth-wrapper
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-# Simple wrapper to not duplicate .script files. Reads extra args from .stdin
-# file, and assumes the actual input file is .c.
-
-if [[ -e ${SRCDIR}/test/${TESTNAME}.stdin ]]; then
-       read ARGS
-fi
-${SRCDIR}/hawkmoth/hawkmoth.py ${ARGS} ${SRCDIR}/test/${TESTNAME}.c
-- 
2.19.2


Other related posts:

  • » [hawkmoth] [PATCH 3/8] test: switch to using python unittests over cmdtest - Jani Nikula