summaryrefslogtreecommitdiffhomepage
path: root/tests/tools
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-23 11:50:17 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-23 11:50:17 -0600
commitb6574b2f3cb86d33d7e55985c7914dfce6dbf296 (patch)
tree22449ab76bbe49bed35b5e6c54019d2802301d6a /tests/tools
parent2161b3c2de4eec4cc5f28cbf683f25acd3c7dbef (diff)
parenta847b938b372995762c8ab581c0be521fd2e8bcb (diff)
downloadzash-docs/logo-and-clean.tar.gz
Merge origin/main into docs/logo-and-cleandocs/logo-and-clean
Resolutions: README.md and DESIGN.md keep the new colour logo (packaging/zash-logo.svg) at width 220; the Makefile keeps main's newer shellcheck header, lists `make docs` in the usage block, and `clean` removes docs, cov and $(ZTOOLS) along with the branch's new tools.
Diffstat (limited to 'tests/tools')
-rw-r--r--tests/tools/zos-shim/zos_shim.h9
-rw-r--r--tests/tools/zos-sleep.c35
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/tools/zos-shim/zos_shim.h b/tests/tools/zos-shim/zos_shim.h
index 5c4bac3..54f5fe9 100644
--- a/tests/tools/zos-shim/zos_shim.h
+++ b/tests/tools/zos-shim/zos_shim.h
@@ -11,6 +11,9 @@
*/
#ifndef ZOS_SHIM_H
#define ZOS_SHIM_H
+/* Tell the sources they are being checked, not built: this is 64-bit
+ * Linux, and sys_zos.c asserts the real build is 31-bit. */
+#define ZASH_ZOS_SHIM 1
#include <fcntl.h>
#include <signal.h>
#include <spawn.h>
@@ -85,6 +88,12 @@ int __osname(struct utsname *);
/* <stdlib.h> fetch() */
typedef int (*__fetch_t)(void);
__fetch_t fetch(const char *);
+int release(void (*)(void));
+
+/* <signal.h>: LE's abend signal. The value is from EDC4H023. */
+#ifndef SIGABND
+#define SIGABND 18
+#endif
/* <spawn.h> (z/OS spawn(), not posix_spawn) */
struct inheritance {
diff --git a/tests/tools/zos-sleep.c b/tests/tools/zos-sleep.c
new file mode 100644
index 0000000..f6272ab
--- /dev/null
+++ b/tests/tools/zos-sleep.c
@@ -0,0 +1,35 @@
+/**
+ * @file zos-sleep.c
+ * @brief A `sleep` that takes fractions, for the z/OS test runs.
+ *
+ * /bin/sleep on z/OS rejects "0.3" ("Improper sleep interval
+ * specification"), and tests/zash/jobs.sh and tests/scripts/parallel.sh
+ * order background jobs with sub-second sleeps. `make zos-check` builds
+ * this and puts its directory in front of PATH; Linux never builds it,
+ * because its own sleep is already fine.
+ */
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+
+int main(int argc, char **argv) {
+ struct timespec ts = {0, 0};
+ if (argc < 2)
+ return 1;
+ for (int i = 1; i < argc; i++) {
+ char *end = NULL;
+ double seconds = strtod(argv[i], &end);
+ if (end == argv[i] || *end != '\0' || seconds < 0)
+ return 1;
+ long whole = (long)seconds;
+ ts.tv_sec += (time_t)whole;
+ ts.tv_nsec += (long)((seconds - (double)whole) * 1e9);
+ }
+ ts.tv_sec += (time_t)(ts.tv_nsec / 1000000000L);
+ ts.tv_nsec %= 1000000000L;
+ while (nanosleep(&ts, &ts) < 0) {
+ if (errno != EINTR)
+ return 1;
+ }
+ return 0;
+}