Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ea74f0cd
Kaydet (Commit)
ea74f0cd
authored
Ock 02, 2017
tarafından
Steve Dower
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24932: Use proper command line parsing in _testembed
üst
4fb5e76d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
12 deletions
+47
-12
test_capi.py
Lib/test/test_capi.py
+1
-1
NEWS
Misc/NEWS
+2
-0
_testembed.c
Programs/_testembed.c
+44
-11
No files found.
Lib/test/test_capi.py
Dosyayı görüntüle @
ea74f0cd
...
...
@@ -385,7 +385,7 @@ class EmbeddingTests(unittest.TestCase):
def
test_subinterps
(
self
):
# This is just a "don't crash" test
out
,
err
=
self
.
run_embedded_interpreter
()
out
,
err
=
self
.
run_embedded_interpreter
(
"repeated_init_and_subinterpreters"
)
if
support
.
verbose
:
print
()
print
(
out
)
...
...
Misc/NEWS
Dosyayı görüntüle @
ea74f0cd
...
...
@@ -680,6 +680,8 @@ Tools/Demos
Tests
-----
-
Issue
#
24932
:
Use
proper
command
line
parsing
in
_testembed
-
Issue
#
28950
:
Disallow
-
j0
to
be
combined
with
-
T
/-
l
in
regrtest
command
line
arguments
.
...
...
Programs/_testembed.c
Dosyayı görüntüle @
ea74f0cd
...
...
@@ -33,7 +33,7 @@ static void print_subinterp(void)
);
}
static
void
test_repeated_init_and_subinterpreters
(
void
)
static
int
test_repeated_init_and_subinterpreters
(
void
)
{
PyThreadState
*
mainstate
,
*
substate
;
#ifdef WITH_THREAD
...
...
@@ -70,6 +70,7 @@ static void test_repeated_init_and_subinterpreters(void)
PyEval_RestoreThread
(
mainstate
);
Py_Finalize
();
}
return
0
;
}
/*****************************************************
...
...
@@ -103,7 +104,7 @@ static void check_stdio_details(const char *encoding, const char * errors)
Py_Finalize
();
}
static
void
test_forced_io_encoding
(
void
)
static
int
test_forced_io_encoding
(
void
)
{
/* Check various combinations */
printf
(
"--- Use defaults ---
\n
"
);
...
...
@@ -122,19 +123,51 @@ static void test_forced_io_encoding(void)
printf
(
"Unexpected success calling Py_SetStandardStreamEncoding"
);
}
Py_Finalize
();
return
0
;
}
/* Different embedding tests */
int
main
(
int
argc
,
char
*
argv
[])
/* *********************************************************
* List of test cases and the function that implements it.
*
* Names are compared case-sensitively with the first
* argument. If no match is found, or no first argument was
* provided, the names of all test cases are printed and
* the exit code will be -1.
*
* The int returned from test functions is used as the exit
* code, and test_capi treats all non-zero exit codes as a
* failed test.
*********************************************************/
struct
TestCase
{
const
char
*
name
;
int
(
*
func
)(
void
);
};
static
struct
TestCase
TestCases
[]
=
{
{
"forced_io_encoding"
,
test_forced_io_encoding
},
{
"repeated_init_and_subinterpreters"
,
test_repeated_init_and_subinterpreters
},
{
NULL
,
NULL
}
};
/* TODO: Check the argument string to allow for more test cases */
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
>
1
)
{
/* For now: assume "forced_io_encoding */
test_forced_io_encoding
();
}
else
{
/* Run the original embedding test case by default */
test_repeated_init_and_subinterpreters
();
for
(
struct
TestCase
*
tc
=
TestCases
;
tc
&&
tc
->
name
;
tc
++
)
{
if
(
strcmp
(
argv
[
1
],
tc
->
name
)
==
0
)
return
(
*
tc
->
func
)();
}
}
return
0
;
/* No match found, or no test name provided, so display usage */
printf
(
"Python "
PY_VERSION
" _testembed executable for embedded interpreter tests
\n
"
"Normally executed via 'EmbeddingTests' in Lib/test/test_capi.py
\n\n
"
"Usage: %s TESTNAME
\n\n
All available tests:
\n
"
,
argv
[
0
]);
for
(
struct
TestCase
*
tc
=
TestCases
;
tc
&&
tc
->
name
;
tc
++
)
{
printf
(
" %s
\n
"
,
tc
->
name
);
}
/* Non-zero exit code will cause test_capi.py tests to fail.
This is intentional. */
return
-
1
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment