Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dspinellis/dgsh
Browse files Browse the repository at this point in the history
  • Loading branch information
dspinellis committed Aug 13, 2020
2 parents 2a7efb4 + d74313e commit 5e09612
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 42 deletions.
4 changes: 1 addition & 3 deletions .travis/macosx-xcode8.3.install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
set -x

brew update
brew install check xz texinfo help2man gettext libelf
brew link texinfo --force
brew install autoconf check xz texinfo help2man gettext libelf
export PATH="/usr/local/opt/texinfo/bin:$PATH"
brew link gettext --force
export PATH="/usr/local/opt/gettext/bin:$PATH"
#wget http://ftp.gnu.org/gnu/gettext/gettext-0.19.5.tar.xz
#tar Jxvf gettext-0.19.5.tar.xz >/dev/null
#cd gettext-0.19.5 && ./configure && make && sudo make install >/dev/null
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ commit:
for i in $$(echo unix-tools/*/.git | sed 's/\.git//g') . ; do grep -v '^#' .git/COMMIT_EDITMSG | (cd $$i && git commit -a -F -) ; done
rm -f .git/COMMIT_EDITMSG

zip:
cd .. && zip -r dgsh.zip dgsh -x *.git*

# Rough uninstall rule to verify that tests pick up correct files
uninstall:
rm -rf $(PREFIX)/bin/dgsh-* $(PREFIX)/libexec/dgsh \
Expand Down
10 changes: 9 additions & 1 deletion core-tools/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ else
CPOW =
endif

if LINUX
DGSH_ASSEMBLY_FILE=dgsh-elf.s
else
if DARWIN
DGSH_ASSEMBLY_FILE=dgsh-macho.s
endif
endif

lib_LIBRARIES = libdgsh.a
libdgsh_a_SOURCES = negotiate.c dgsh-elf.S
libdgsh_a_SOURCES = negotiate.c $(DGSH_ASSEMBLY_FILE)

include_HEADERS = dgsh.h

Expand Down
15 changes: 1 addition & 14 deletions core-tools/src/dgsh-elf.S → core-tools/src/dgsh-elf.s
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#if defined(__APPLE__)

.section ".note.ident", "a"
.asciz "DSpinellis/dgsh"
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 13
.globl _dgsh_force_include ## @dgsh_force_include
.zerofill __DATA,__common,_dgsh_force_include,4,2

.subsections_via_symbols

#else

# ELF note header to mark dgsh-compatible programs
# See http://www.netbsd.org/docs/kernel/elf-notes.html

.comm dgsh_force_include,4,4
.section ".note.ident", "a"
.p2align 2
Expand All @@ -25,4 +13,3 @@
.long 0x00000000
3: .p2align 2

#endif
6 changes: 4 additions & 2 deletions core-tools/src/dgsh-tee.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct sink_info {
};

/* Construct a new sink_info object */
struct sink_info *
static struct sink_info *
new_sink_info(const char *name)
{
struct sink_info *ofp;
Expand Down Expand Up @@ -208,7 +208,7 @@ fd_name(int fd)


/* Construct a new source_info object */
struct source_info *
static struct source_info *
new_source_info(const char *name)
{
struct source_info *ifp;
Expand Down Expand Up @@ -502,6 +502,8 @@ source_buffer(struct source_info *ifp, /* OUT */ struct io_buffer *b)

if (!memory_allocate(ifp->bp, pool))
return false;
if (ifp->bp->buffers[pool].s != s_memory)
DPRINTF(4, "ifp->bp->buffers[pool].s = 0x%x, pool=%d\n", ifp->bp->buffers[pool].s, pool);
assert(ifp->bp->buffers[pool].s == s_memory);
b->p = ifp->bp->buffers[pool].p + pool_offset;
b->size = buffer_size - pool_offset;
Expand Down
26 changes: 16 additions & 10 deletions core-tools/tests-regression/test-dgsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ ensure_same spell-highlight
$DGSH $EXAMPLE/map-hierarchy.sh map-hierarchy/in/a map-hierarchy/in/b map-hierarchy/out.test
ensure_same map-hierarchy

(
cd $TOP/unix-tools/grep
LC_ALL=C $DGSH $EXAMPLE/commit-stats.sh --since=2010-01-01Z00:00 \
--until=2015-12-31Z23:59 \
>$TOP/core-tools/tests-regression/commit-stats/out.test
)
ensure_same commit-stats
if [ -f "$TOP/unix-tools/grep/.git" ] && [ -d "$TOP/.git" ]; then
(
cd $TOP/unix-tools/grep
LC_ALL=C $DGSH $EXAMPLE/commit-stats.sh --since=2010-01-01Z00:00 \
--until=2015-12-31Z23:59 \
>$TOP/core-tools/tests-regression/commit-stats/out.test
)
ensure_same commit-stats
else
echo "Skip commit-stats test because input is missing (grep's git repo)"
fi

# Test depends heavily on the grep utility,
# which is under improvement (see issue #31)
# This example outputs different result for NMACRO than the template
# due to a variation in the behavior of grep or a variation in the
# implementation of the sgsh example in regression/scripts/code-metrics.ok.
# The test succeeds in Mac OS.
#DGSH_TIMEOUT=20 $DGSH $EXAMPLE/code-metrics.sh code-metrics/in/ >code-metrics/out.test 2>/dev/null
#ensure_same code-metrics

Expand All @@ -76,7 +82,7 @@ ensure_same word-properties
$DGSH $EXAMPLE/compress-compare.sh <word-properties/LostWorldChap1-3 | sed 's/:.*ASCII.*/: ASCII/;s|/dev/stdin:||' >compress-compare/out.test
ensure_same compress-compare

KVSTORE_RETRY_LIMIT=60 DGSH_TIMEOUT=60 $DGSH $EXAMPLE/web-log-report.sh <web-log-report/logfile >web-log-report/out.test
KVSTORE_RETRY_LIMIT=100 DGSH_TIMEOUT=60 $DGSH $EXAMPLE/web-log-report.sh <web-log-report/logfile >web-log-report/out.test
ensure_same web-log-report

(
Expand Down
1 change: 1 addition & 0 deletions core-tools/tests-regression/test-tee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ do
cat try2 >try2.out &
{ read x ; echo $x ; sleep 1 ; cat ; } < try > try.out &
wait
cat err
ensure_same "Low-memory temporary file (try) $flags" lines try.out
ensure_same "Low-memory temporary file (try2) $flags" lines try2.out
rm -f lines try try2 try.out try2.out err
Expand Down
8 changes: 4 additions & 4 deletions core-tools/tests-regression/test-wrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ $DGSH -c 'dgsh-enumerate 1 | {{ dgsh-wrap -i 0 echo hi ; dgsh-wrap dd 2>/dev/nul
ensure_same echo-deaf

# Test that echo is wrapped as deaf when wrapped as script with supplied exec
echo "#!$TOP/build/libexec/dgsh/dgsh-wrap -S -i 0 `which echo`" >dgsh-wrap/echo-S
chmod +x dgsh-wrap/echo-S
$DGSH -c 'dgsh-enumerate 1 | {{ dgsh-wrap/echo-S hi ; dgsh-wrap dd 2>/dev/null ; }} | cat' >dgsh-wrap/echo-S.test
ensure_same echo-S
echo "#!$TOP/build/libexec/dgsh/dgsh-wrap -S -i 0 `which echo`" >dgsh-wrap/echo-s_caps
chmod +x dgsh-wrap/echo-s_caps
$DGSH -c 'dgsh-enumerate 1 | {{ dgsh-wrap/echo-s_caps hi ; dgsh-wrap dd 2>/dev/null ; }} | cat' >dgsh-wrap/echo-s_caps.test
ensure_same echo-s_caps

# Test that echo is wrapped as deaf when wrapped as script with implied exec
echo "#!$TOP/build/libexec/dgsh/dgsh-wrap -s -i 0" >dgsh-wrap/echo
Expand Down
8 changes: 2 additions & 6 deletions unix-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,14 @@ test-bash: ../test-data/fid
# TODO reinstate after fixin it
# ./run_test.sh $(PSDIR) $(EGDIR)/set-operations.sh file $(PSDIR)
./run_test.sh $(PSDIR) $(EGDIR)/compress-compare.sh pipe Readme.md
# TODO check that .git repo exists
./run_test.sh $(PSDIR) $(EGDIR)/commit-stats.sh
DGSH_TIMEOUT=20 ./run_test.sh $(PSDIR) $(EGDIR)/uniform-5x5.sh
./run_test.sh $(PSDIR) $(EGDIR)/duplicate-files.sh file coreutils
./run_test.sh $(PSDIR) $(EGDIR)/spell-highlight.sh pipe Readme.md
./run_test.sh $(PSDIR) $(EGDIR)/static-functions.sh file coreutils
./run_test.sh $(PSDIR) $(EGDIR)/word-properties.sh file Readme.md
-rm -rf grep2 grep-p100
cp -R grep grep2 && \
cp -R grep2 grep-p100 && \
cd grep-p100 && git checkout HEAD~100 >/dev/null && \
cd ../grep2 && git checkout master && cd ..
./run_test.sh $(PSDIR) $(EGDIR)/map-hierarchy.sh file grep2 grep-p100 grepp
./run_test.sh $(PSDIR) $(EGDIR)/map-hierarchy.sh file ../core-tools/tests-regression/map-hierarchy/in/a ../core-tools/tests-regression/map-hierarchy/in/b c
./run_test.sh $(PSDIR) $(EGDIR)/text-properties.sh pipe Readme.md
cd coreutils && \
../run_test.sh ../$(PSDIR) ../$(EGDIR)/committer-plot.sh -- pnmtopng pamscale pgmmorphconv
Expand Down
2 changes: 1 addition & 1 deletion unix-tools/bash
Submodule bash updated 2 files
+250 −34 dgsh_util.c
+17 −6 execute_cmd.c
2 changes: 1 addition & 1 deletion unix-tools/grep
Submodule grep updated 1 files
+24 −20 src/grep.c

0 comments on commit 5e09612

Please sign in to comment.