-
Notifications
You must be signed in to change notification settings - Fork 70
tests: fix integration_runner opcache module loading #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
7f6aacf
73e64cd
cf48e0d
c35e124
6fe3be5
786a5f9
2b140d0
87032c2
c5527e8
f25f685
2380fd3
fabe256
2a89f4b
412fba7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,43 @@ func PhpTx(src Script, env, settings map[string]string, ctx *Context) (Tx, error | |
// Note: file path must be relative to the working directory. | ||
var txn Tx | ||
|
||
args := phpArgs(nil, filepath.Base(src.Name()), false, settings) | ||
// Make a copy of settings to avoid mutating the original map | ||
phpSettings := make(map[string]string, len(settings)) | ||
setOPCacheEnable := true | ||
setOPCacheEnableCLI := true | ||
for k, v := range settings { | ||
phpSettings[k] = v | ||
|
||
// see if settings affect opcache config | ||
// if so then we will not set config below | ||
if k == "opcache.enable" { | ||
setOPCacheEnable = false | ||
} else if k == "opcache.enable_cli" { | ||
setOPCacheEnableCLI = false | ||
} | ||
} | ||
if ctx.UseOPCache { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems correct. |
||
if !ctx.OPCacheModuleLoaded[ctx.CGI] { | ||
phpSettings["zend_extension"] = "opcache.so" | ||
} | ||
if setOPCacheEnable { | ||
phpSettings["opcache.enable"] = "1" | ||
} | ||
if setOPCacheEnableCLI { | ||
phpSettings["opcache.enable_cli"] = "1" | ||
} | ||
} else { | ||
if setOPCacheEnable { | ||
phpSettings["opcache.enable"] = "0" | ||
} | ||
if setOPCacheEnableCLI { | ||
phpSettings["opcache.enable_cli"] = "0" | ||
} | ||
} | ||
|
||
args := phpArgs(nil, filepath.Base(src.Name()), false, phpSettings) | ||
|
||
if ctx.Valgrind != "" && settings["newrelic.appname"] != "skipif" { | ||
if ctx.Valgrind != "" && phpSettings["newrelic.appname"] != "skipif" { | ||
txn = &ValgrindCLI{ | ||
CLI: CLI{ | ||
Path: ctx.PHP, | ||
|
@@ -106,14 +140,48 @@ func CgiTx(src Script, env, settings map[string]string, headers http.Header, ctx | |
return nil, fmt.Errorf("unable to create cgi request: %v", err) | ||
} | ||
|
||
// Make a copy of settings to avoid mutating the original map | ||
cgiSettings := make(map[string]string, len(settings)) | ||
setOPCacheEnable := true | ||
setOPCacheEnableCLI := true | ||
for k, v := range settings { | ||
cgiSettings[k] = v | ||
|
||
// see if settings affect opcache config | ||
// if so then we will not set config below | ||
if k == "opcache.enable" { | ||
setOPCacheEnable = false | ||
} else if k == "opcache.enable_cli" { | ||
setOPCacheEnableCLI = false | ||
} | ||
} | ||
if ctx.UseOPCache { | ||
if !ctx.OPCacheModuleLoaded[ctx.CGI] { | ||
cgiSettings["zend_extension"] = "opcache.so" | ||
} | ||
if setOPCacheEnable { | ||
cgiSettings["opcache.enable"] = "1" | ||
} | ||
if setOPCacheEnableCLI { | ||
cgiSettings["opcache.enable_cli"] = "1" | ||
} | ||
} else { | ||
if setOPCacheEnable { | ||
cgiSettings["opcache.enable"] = "0" | ||
} | ||
if setOPCacheEnableCLI { | ||
cgiSettings["opcache.enable_cli"] = "0" | ||
} | ||
} | ||
|
||
if ctx.Valgrind != "" { | ||
tx := &ValgrindCGI{ | ||
CGI: CGI{ | ||
request: req, | ||
handler: &cgi.Handler{ | ||
Path: ctx.CGI, | ||
Dir: src.Dir(), | ||
Args: phpArgs(nil, "", false, settings), | ||
Args: phpArgs(nil, "", false, cgiSettings), | ||
}, | ||
}, | ||
Valgrind: ctx.Valgrind, | ||
|
@@ -144,7 +212,7 @@ func CgiTx(src Script, env, settings map[string]string, headers http.Header, ctx | |
handler: &cgi.Handler{ | ||
Path: ctx.CGI, | ||
Dir: src.Dir(), | ||
Args: phpArgs(nil, "", false, settings), | ||
Args: phpArgs(nil, "", false, cgiSettings), | ||
}, | ||
} | ||
tx.handler.Env = append(tx.handler.Env, | ||
|
Uh oh!
There was an error while loading. Please reload this page.