< prev index next >

test/script/nosecurity/JDK-8151291.js

Print this page
rev 1637 : 8151518: relax test requirements to reduce dependency on directory contents


  42 }
  43 
  44 function neq(p, q, e) {
  45     if (p == q) {
  46         throw e
  47     }
  48 }
  49 
  50 var File    = Java.type("java.io.File"),
  51     System  = Java.type("java.lang.System"),
  52     win     = System.getProperty("os.name").startsWith("Windows"),
  53     sep     = File.separator,
  54     startwd = $ENV.PWD,
  55     upwd    = startwd.substring(0, startwd.lastIndexOf(sep))
  56 
  57 $EXEC("ls")
  58 var ls_startwd = $OUT
  59 $EXEC("cd ..; ls")
  60 var ls_cdupwd = $OUT
  61 eq($ENV.PWD, startwd, 'PWD changed during $EXEC cd')
  62 neq(ls_startwd, ls_cdupwd, 'same ls result for startwd and upwd')

  63 
  64 $ENV.PWD = upwd
  65 eq($ENV.PWD, upwd, '$ENV.PWD change had no effect')
  66 $EXEC("ls")
  67 var ls_epupwd = $OUT
  68 eq(ls_cdupwd, ls_epupwd, 'different results for upwd')



  42 }
  43 
  44 function neq(p, q, e) {
  45     if (p == q) {
  46         throw e
  47     }
  48 }
  49 
  50 var File    = Java.type("java.io.File"),
  51     System  = Java.type("java.lang.System"),
  52     win     = System.getProperty("os.name").startsWith("Windows"),
  53     sep     = File.separator,
  54     startwd = $ENV.PWD,
  55     upwd    = startwd.substring(0, startwd.lastIndexOf(sep))
  56 
  57 $EXEC("ls")
  58 var ls_startwd = $OUT
  59 $EXEC("cd ..; ls")
  60 var ls_cdupwd = $OUT
  61 eq($ENV.PWD, startwd, 'PWD changed during $EXEC cd')
  62 neq(ls_startwd, ls_cdupwd, 'same ls result for startwd and upwd with $EXEC cd')

  63 
  64 $ENV.PWD = upwd
  65 eq($ENV.PWD, upwd, '$ENV.PWD change had no effect')
  66 $EXEC("ls")
  67 var ls_epupwd = $OUT
  68 neq(ls_startwd, ls_epupwd, 'same ls result for startwd and upwd with $ENV.PWD cd')

< prev index next >