Browse files

dtest: Disable optimization of the compiled tests

GCC optimizes ever more enthusiastically: At version 4, even at -O2, it
does so in ways that break these tests and that are increasingly
difficult to prevent with code changes.  Instead of increasing levels of
trickery, just disable optimization.

The specific problems we've had are:

- pid/tst.args1

  Notices that the arguments passed to go() are unused, and so
  doesn't actually pass them.

- pid/tst.ret1, pid/tst.ret2

  Notices that handle() calling go() is without side-effect, doesn't do

- profile-n/tst.ufuncsort, java_api/tst.ProbeData, java_api/tst.FunctionLookup

  Notices that because fN is static, it doesn't need to use the normal
  i386 ABI and instead passes arg0 in %eax, rather than
  on the stack.
  • Loading branch information...
1 parent 812d625 commit 9d633eb43f03b96fb91fca87cfbeca3cc1276b80 @richlowe richlowe committed Dec 5, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 usr/src/cmd/dtrace/test/tst/
@@ -23,8 +23,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-# ident "%Z%%M% %I% %E% SMI"
include $(SRC)/cmd/Makefile.cmd
@@ -56,6 +54,12 @@ ROOT_EXES = $(EXES:%=$(TSTDIR)/%)
+# The DTrace tests rely on "normal" behaviour from the compiler which
+# agressive optimization of small, simple, one compilation-unit programs may
+# utterly subvert. We force the compiler to not optimize rather than engage
+# in an arms race with increasingly belligerent optimizers.
all: $(EXES)
clean lint:

0 comments on commit 9d633eb

Please sign in to comment.