From 9144d93cdce428a8780c3e8d9460e889acb63425 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 21 Aug 2026 17:42:01 -0700 Subject: [PATCH] Add a simple autoconf test. NFC We have larger autoconf tests but its good to have a small unit test to test specific things. See #27583 --- test/autoconf/configure.ac | 10 ++++++++++ test/test_other.py | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/autoconf/configure.ac diff --git a/test/autoconf/configure.ac b/test/autoconf/configure.ac new file mode 100644 index 0000000000000..4d061d87b673d --- /dev/null +++ b/test/autoconf/configure.ac @@ -0,0 +1,10 @@ +AC_INIT([test], [1.0]) +AC_PROG_CC +AC_CHECK_FUNCS([getcwd getwd nonexistent_func]) +AC_CHECK_HEADERS([stdio.h nonexistent_header.h]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include ]], [[return 0;]])], + [run_ok=yes], [run_ok=no]) +AS_IF([test "x$run_ok" = xyes], + [AC_MSG_NOTICE([run test passed])], + [AC_MSG_ERROR([run test failed])]) +AC_OUTPUT diff --git a/test/test_other.py b/test/test_other.py index 856d84a72191f..4626e9ba46375 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -12518,6 +12518,18 @@ def test_autoconf_check_lib_side_module(self): ''') self.run_process([EMCC, 'conftest.c', 'libtest.so', '-o', 'conftest.js']) + @no_windows('configure scripts are Unix shell scripts') + @requires_tool('autoconf') + def test_autoconf_configure(self): + copytree(test_file('autoconf'), '.') + self.run_process(['autoconf']) + out = self.run_process([EMCONFIGURE, './configure'], stdout=PIPE).stdout + self.assertContained('checking for getcwd... yes', out) + self.assertContained('checking for getwd... no', out) + self.assertContained('checking for nonexistent_func... no', out) + self.assertContained('checking for nonexistent_header.h... no', out) + self.assertContained('configure: run test passed', out) + def test_standalone_export_main(self): # Tests that explicitly exported `_main` does not fail, even though `_start` is the entry # point.