[m-rev.] diff: fix for interactive_query v.s. --use-subdirs

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 27 20:38:08 AEDT 2002


Estimated hours taken: 1
Branches: main

browser/interactive_query.m:
	Use the correct object file name when --use-subdirs is specified.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Use a different input file for the `interactive' test case
	depending on whether `--use-subdirs' is enabled.
	The .inp.subdirs file contains the line `mmc_options --use-subdirs'.
	We strip this line out of the output before comparing with
	the .exp* files.

Workspace: /home/mars/fjh/ws1/mercury
Index: browser/interactive_query.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/interactive_query.m,v
retrieving revision 1.11
diff -u -d -r1.11 interactive_query.m
--- browser/interactive_query.m	25 Sep 2001 09:36:49 -0000	1.11
+++ browser/interactive_query.m	26 Feb 2002 10:10:15 -0000
@@ -425,6 +425,18 @@
 		" query.m"], Command) },
 	invoke_system_command(Command, Succeeded0),
 	( { Succeeded0 = yes } ->
+		% Figure out the location of the object file,
+		% which will depend on whether --use-subdirs was specified.
+		% XXX This code doesn't properly handle the case when the
+		% option is later overridden, e.g. if the options are
+		% `--use-subdirs --no-use-subdirs'.  But that case
+		% is not very likely to occur in practice...
+		{ string__sub_string_search(Options, "--use-subdirs", _) ->
+			QueryObject = "Mercury/os/query.o"
+		;
+			QueryObject = "query.o"
+		},
+			
 		% We use the following options:
 		%	--make-shared-lib
 		%		needed so we can dynamically load in the
@@ -438,7 +450,7 @@
 			" --trace",
 			" --allow-undefined",
 			" --make-shared-lib ", Options,
-			" -o libquery.so query.o"], Command2) },
+			" -o libquery.so ", QueryObject], Command2) },
 		invoke_system_command(Command2, Succeeded)
 	;
 		{ Succeeded = no }
Index: tests/debugger/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/Mmakefile,v
retrieving revision 1.64
diff -u -d -r1.64 Mmakefile
--- tests/debugger/Mmakefile	25 Feb 2002 03:52:48 -0000	1.64
+++ tests/debugger/Mmakefile	27 Feb 2002 09:34:21 -0000
@@ -278,17 +278,24 @@
 # interactive.inp contains interactive queries that require interactive.ints
 # to have been built.
 
-interactive.out.orig: interactive interactive.inp $(interactive.ints)
-	$(MDB) ./interactive < interactive.inp > interactive.out.orig 2>&1
+ifeq ($(MMAKE_USE_SUBDIRS),yes)
+INTERACTIVE_INP = interactive.inp.subdirs
+else
+INTERACTIVE_INP = interactive.inp.nosubdirs
+endif
 
-# We pipe the output through sed to remove some spurious warnings that
-# `ld' issues.
+interactive.out.orig: interactive $(INTERACTIVE_INP) $(interactive.ints)
+	$(MDB) ./interactive < $(INTERACTIVE_INP) > interactive.out.orig 2>&1
+
+# We pipe the output through sed to avoid differences for `--use-subdirs',
+# and to remove some spurious warnings that `ld' issues.
 # XXX we should fix the spurious warnings about unresolved symbols.
 # (The spurious warnings about exception handling are due to a flaw
 # in the Digital Unix 3.2 linker, so that one is DEC's problem.)
 interactive.out: interactive.out.orig
 	cat interactive.out.orig | \
 		sed \
+		    -e '/mdb> mmc_options --use-subdirs/d' \
 		    -e '/\/usr\/bin\/ld:$$/N' \
 		    -e 's/\/usr\/bin\/ld:.//' \
 		    -e '/Warning: Linking some objects which contain exception information sections$$/N' \
Index: tests/debugger/interactive.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/interactive.exp,v
retrieving revision 1.3
diff -u -d -r1.3 interactive.exp
--- tests/debugger/interactive.exp	11 Dec 2001 09:01:21 -0000	1.3
+++ tests/debugger/interactive.exp	27 Feb 2002 07:49:32 -0000
@@ -100,8 +100,6 @@
 Unknown command `#'. Give the command `help' for help.
 mdb> #
 Unknown command `#'. Give the command `help' for help.
-mdb> mmc_options --use-subdirs
-mdb> mmc_options
 mdb> query interactive list
 ?- <stdin>:026: Inferred :- pred query((list:list(character)), (list:list(character))).
 <stdin>:026: Inferred :- mode query(out, out) is multi.
Index: tests/debugger/interactive.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/interactive.exp2,v
retrieving revision 1.1
diff -u -d -r1.1 interactive.exp2
--- tests/debugger/interactive.exp2	29 Dec 2001 08:15:50 -0000	1.1
+++ tests/debugger/interactive.exp2	27 Feb 2002 07:49:40 -0000
@@ -102,8 +102,6 @@
 Unknown command `#'. Give the command `help' for help.
 mdb> #
 Unknown command `#'. Give the command `help' for help.
-mdb> mmc_options --use-subdirs
-mdb> mmc_options
 mdb> query interactive list
 ?- <stdin>:026: Inferred :- pred query((list:list(character)), (list:list(character))).
 <stdin>:026: Inferred :- mode query(out, out) is multi.
Index: tests/debugger/interactive.inp
===================================================================
RCS file: tests/debugger/interactive.inp
diff -N tests/debugger/interactive.inp
--- tests/debugger/interactive.inp	11 Dec 2001 09:01:21 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-echo on
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-level 1
-print *
-up 1
-vars
-print *
-
-print HeadVar__1
-print HeadVar__2
-print HeadVar__3
-
-print *
-
-print *
-
-print *
-
-print *
-
-print *
-
-goto -a 20
-stack
-stack -d
-print *
-#
-# Test interactive queries.
-#
-mmc_options --use-subdirs
-mmc_options
-query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-qperm([1,2,"foo"], List).
-qperm(List, [1]).
-quit.
-cc_query interactive list
-append(X, Y, ['a', 'b', 'c']).
-qperm([1,2,3], List).
-qperm([1,2,3], List), List = [2 | _].
-qperm([1,2,3], List), List = [4 | _].
-quit.
-io_query interactive list
-main.
-if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
-if { qperm([1,2,3], List) } then print(List), nl else [].
-if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
-if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
-quit.
-retry
-print *
-finish -a
-register --quiet
-break print_list
-break qdelete
-continue -a
-step -aS 5
-disable 1
-continue -n
-continue -n -S
Index: tests/debugger/interactive.inp.nosubdirs
===================================================================
RCS file: tests/debugger/interactive.inp.nosubdirs
diff -N tests/debugger/interactive.inp.nosubdirs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/interactive.inp.nosubdirs	27 Feb 2002 07:48:19 -0000
@@ -0,0 +1,75 @@
+echo on
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+level 1
+print *
+up 1
+vars
+print *
+
+print HeadVar__1
+print HeadVar__2
+print HeadVar__3
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+goto -a 20
+stack
+stack -d
+print *
+#
+# Test interactive queries.
+#
+query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+qperm([1,2,"foo"], List).
+qperm(List, [1]).
+quit.
+cc_query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+quit.
+io_query interactive list
+main.
+if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
+if { qperm([1,2,3], List) } then print(List), nl else [].
+if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
+if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
+quit.
+retry
+print *
+finish -a
+register --quiet
+break print_list
+break qdelete
+continue -a
+step -aS 5
+disable 1
+continue -n
+continue -n -S
Index: tests/debugger/interactive.inp.subdirs
===================================================================
RCS file: tests/debugger/interactive.inp.subdirs
diff -N tests/debugger/interactive.inp.subdirs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/interactive.inp.subdirs	27 Feb 2002 07:48:36 -0000
@@ -0,0 +1,76 @@
+echo on
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+level 1
+print *
+up 1
+vars
+print *
+
+print HeadVar__1
+print HeadVar__2
+print HeadVar__3
+
+print *
+
+print *
+
+print *
+
+print *
+
+print *
+
+goto -a 20
+stack
+stack -d
+print *
+#
+# Test interactive queries.
+#
+mmc_options --use-subdirs
+query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+qperm([1,2,"foo"], List).
+qperm(List, [1]).
+quit.
+cc_query interactive list
+append(X, Y, ['a', 'b', 'c']).
+qperm([1,2,3], List).
+qperm([1,2,3], List), List = [2 | _].
+qperm([1,2,3], List), List = [4 | _].
+quit.
+io_query interactive list
+main.
+if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
+if { qperm([1,2,3], List) } then print(List), nl else [].
+if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
+if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
+quit.
+retry
+print *
+finish -a
+register --quiet
+break print_list
+break qdelete
+continue -a
+step -aS 5
+disable 1
+continue -n
+continue -n -S

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list